如何为 codeigniter 配置 WAMP?
How to configure WAMP for codeingiter?
我一直在使用Codeigniter,突然遇到一个奇怪的问题。我下载了 CI-2.2.6 并将其放在我的 WAMP root.So 下 对于我的项目,我 link 在 page_head 文件中编辑了所有 CSS 和 JS 使用SITE_URL函数。但是不知何故,当我打开页面源时它不起作用我得到这个 link
<link href="http://::1/portal/css/jquery-ui.css" rel="stylesheet">
应该是:
<link href="http://localhost/portal/css/jquery-ui.css" rel="stylesheet">
当我输入 127.0.0.1 然后我的项目工作得很好。
我如何为 localhost/projectname
实现相同的功能
我的一个朋友告诉我它是 IPV6 error/issue。那么我应该做些什么改变才能使我的 site_url 成为 localhost/projectname 而不是 https://::1/project
我会使用 url 辅助功能
$this->load->helper('url');
或者您可以在应用程序 > 配置 > autoload.php
中自动加载它
然后你可以使用
<?php echo base_url('assets/css/jquery-ui.css');?>
在控制器上使用网站 url,在视图上使用 url 我觉得效果更好。
正在观看
<link type="text/css" rel="stylesheet" href="<?php echo base_url('assets/css/jquery-ui.css');?>">
目录布局
application
assets > css
assets > js
assets > images
system
.htaccess
index.php
在应用程序 > 配置 > config.php 不要将基数 url 留空
$config['base_url'] = 'http://localhost/portal/';
// If need to remove index.php make blank
$config['index_page'] = '';
此外,当您使用 wamp 并且需要在主目录中有一个 htacess 文件时,请确保您已启用 Apache 模块 重写模块
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond !^(index\.php|assets|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/ [L,QSA]
使用简单的 php 文件检查您的 wamp 服务器。如果它工作正常,那么您系统的 wamp 配置问题就没有问题。实际上,您需要使用 system/computer 而不是 codeingiter
检查 wamp 配置
请参阅这些正确安装和配置指南:Link
我一直在使用Codeigniter,突然遇到一个奇怪的问题。我下载了 CI-2.2.6 并将其放在我的 WAMP root.So 下 对于我的项目,我 link 在 page_head 文件中编辑了所有 CSS 和 JS 使用SITE_URL函数。但是不知何故,当我打开页面源时它不起作用我得到这个 link
<link href="http://::1/portal/css/jquery-ui.css" rel="stylesheet">
应该是:
<link href="http://localhost/portal/css/jquery-ui.css" rel="stylesheet">
当我输入 127.0.0.1 然后我的项目工作得很好。 我如何为 localhost/projectname
实现相同的功能我的一个朋友告诉我它是 IPV6 error/issue。那么我应该做些什么改变才能使我的 site_url 成为 localhost/projectname 而不是 https://::1/project
我会使用 url 辅助功能
$this->load->helper('url');
或者您可以在应用程序 > 配置 > autoload.php
中自动加载它然后你可以使用
<?php echo base_url('assets/css/jquery-ui.css');?>
在控制器上使用网站 url,在视图上使用 url 我觉得效果更好。
正在观看
<link type="text/css" rel="stylesheet" href="<?php echo base_url('assets/css/jquery-ui.css');?>">
目录布局
application
assets > css
assets > js
assets > images
system
.htaccess
index.php
在应用程序 > 配置 > config.php 不要将基数 url 留空
$config['base_url'] = 'http://localhost/portal/';
// If need to remove index.php make blank
$config['index_page'] = '';
此外,当您使用 wamp 并且需要在主目录中有一个 htacess 文件时,请确保您已启用 Apache 模块 重写模块
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond !^(index\.php|assets|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/ [L,QSA]
使用简单的 php 文件检查您的 wamp 服务器。如果它工作正常,那么您系统的 wamp 配置问题就没有问题。实际上,您需要使用 system/computer 而不是 codeingiter
检查 wamp 配置请参阅这些正确安装和配置指南:Link