我怎么写本地 url
how i can write local url
我无法将 php 连接到数据库,我在 windows 中使用 xampp,消息:
Fatal error: Can't use function return value in write context in
代码:
<?php
define('ENV_LOCAL_URL') = 'localhost';
if(strstr(filter_input(INPUT_SERVER, 'SERVER_NAME'), ENV_LOCAL_URL)) {
define('ENVIRONMENT', 'DEV');
error_reporting(E_ALL);
ini_set('display_errors', 'On');
} else {
define('ENVIRONMENT', 'LIVE');
}
$errors = [];
define('ENTRY_CODE', 'password'); // App's password
define('COOKIE_ACCESS_NAME', 'appAccess');
define('COOKIE_ACCESS_VALUE', 's0d983rh203983');
define('COOKIE_EXPIRE', 60*60*24); // 1 day
define('COOKIE_GROUP_ID', 'appGroId');
define('COOKIE_REDIRECTION_NAME', 'appRedSit');
define('ANSWERS_QTY', '3'); // Quantity of questions
define('ANSWER_1', '2'); // Question's correct answer
define('ANSWER_2', '2'); // Question's correct answer
define('ANSWER_3', '2'); // Question's correct answer
define('ANSWER_POINTS', '1'); // Points for each correct answer
define('DIR', realpath(__DIR__.DIRECTORY_SEPARATOR.'..'));
define('ROOT', '/');
define('DIR_IMG', ROOT.'img/');
define('DIR_VIEWS', DIR.DIRECTORY_SEPARATOR.'views/');
require 'database.php';
require 'classes/access_util.php';
require 'classes/group.php';
require 'classes/answer.php';
require 'classes/redirection_util.php';
和数据库页面:
$db_name = 'dbname'; // Database's name
$db_servername = "localhost"; // Database's server (default: localhost)
$db_username = "root"; // Database's user
$db_password = "a12345"; // Database's user's password
phpdefine()
方法可用于设置常量,但不能用于比较或使用=
设置。
尝试将 define('ENV_LOCAL_URL') = 'localhost';
更改为 define('ENV_LOCAL_URL', 'localhost');
我无法将 php 连接到数据库,我在 windows 中使用 xampp,消息:
Fatal error: Can't use function return value in write context in
代码:
<?php
define('ENV_LOCAL_URL') = 'localhost';
if(strstr(filter_input(INPUT_SERVER, 'SERVER_NAME'), ENV_LOCAL_URL)) {
define('ENVIRONMENT', 'DEV');
error_reporting(E_ALL);
ini_set('display_errors', 'On');
} else {
define('ENVIRONMENT', 'LIVE');
}
$errors = [];
define('ENTRY_CODE', 'password'); // App's password
define('COOKIE_ACCESS_NAME', 'appAccess');
define('COOKIE_ACCESS_VALUE', 's0d983rh203983');
define('COOKIE_EXPIRE', 60*60*24); // 1 day
define('COOKIE_GROUP_ID', 'appGroId');
define('COOKIE_REDIRECTION_NAME', 'appRedSit');
define('ANSWERS_QTY', '3'); // Quantity of questions
define('ANSWER_1', '2'); // Question's correct answer
define('ANSWER_2', '2'); // Question's correct answer
define('ANSWER_3', '2'); // Question's correct answer
define('ANSWER_POINTS', '1'); // Points for each correct answer
define('DIR', realpath(__DIR__.DIRECTORY_SEPARATOR.'..'));
define('ROOT', '/');
define('DIR_IMG', ROOT.'img/');
define('DIR_VIEWS', DIR.DIRECTORY_SEPARATOR.'views/');
require 'database.php';
require 'classes/access_util.php';
require 'classes/group.php';
require 'classes/answer.php';
require 'classes/redirection_util.php';
和数据库页面:
$db_name = 'dbname'; // Database's name
$db_servername = "localhost"; // Database's server (default: localhost)
$db_username = "root"; // Database's user
$db_password = "a12345"; // Database's user's password
phpdefine()
方法可用于设置常量,但不能用于比较或使用=
设置。
尝试将 define('ENV_LOCAL_URL') = 'localhost';
更改为 define('ENV_LOCAL_URL', 'localhost');