Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在codeigniter中设置基本url_Codeigniter - Fatal编程技术网

如何在codeigniter中设置基本url

如何在codeigniter中设置基本url,codeigniter,Codeigniter,我有codeigniter项目,我想上传到本地服务器:192.168.x.xxx 但我不知道如何将配置文件中的base\u url从本地主机更改为包含IP地址的本地服务器。如何设置$config['base\u url']?谢谢我会把它设置成这样 $config['base_url'] = 'http://localhost/project/'; 有域名 $config['base_url'] = 'http://www.yourdomainname.com/'; 用/ 如果不设置基本url

我有codeigniter项目,我想上传到本地服务器:
192.168.x.xxx


但我不知道如何将配置文件中的
base\u url
从本地主机更改为包含IP地址的本地服务器。如何设置
$config['base\u url']
?谢谢

我会把它设置成这样

$config['base_url'] = 'http://localhost/project/';
有域名

$config['base_url'] = 'http://www.yourdomainname.com/';
/

如果不设置基本url链接和css,图像等将无法正常工作

试着这样做:

index.php:

define('APP_URL', ($_SERVER['SERVER_PORT'] == 443 ? 'https' : 'http') . "://{$_SERVER['SERVER_NAME']}".str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']));
$config['base_url'] = APP_URL;
config.php:

define('APP_URL', ($_SERVER['SERVER_PORT'] == 443 ? 'https' : 'http') . "://{$_SERVER['SERVER_NAME']}".str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']));
$config['base_url'] = APP_URL;
参考资料:

试着这样做:

$config['base_url'] = 'http://192.168.3.107/pkl2017';  

注意:
pkl2017
是您的项目文件夹名称。

看看这些,看起来很相似。我改了。我的网站怎么了?我在本地服务器上载了codeigniter项目,但仍然找不到404页。$config['base_url']=“ftp://”“$_server[“192.168.3.107”]。“/pkl2017”;它是对的吗?它是您本地的开发环境吗?我认为它应该类似于“http://.$\u SERVER['SERVER\u ADDR']”通往“你的项目”的路径;我设置了这个$config['base\u url']='http://.$\u服务器['192.168.3.107']pkl2017/keluhan.php';但是仍然错误不要使用ip地址,还要确保您已经正确命名了控制器、模型等,其中只有第一个字母是大写字母,这里解释了类和文件名。如何设置基本url?因为那个ip地址就是我的网站