我正在接手一个 codeigniter 项目,该项目最初是在 OSX 上的 MAMP 中开发的。
我的 php 开发环境是 Windows 上的 XAMPP。非常适合我所有其他工作和项目。不过,我将这个应用程序复制到了我的 htdocs 文件夹中,它可以工作,但会导致重写 URL 时出现很多问题(例如,ModRewrite 在应该工作时不起作用,请参阅 ModRewrite 不适用于 codeigniter 站点)。
这些问题是否源于两个开发环境?在我的主机上它工作正常,但我需要进行更改。
编辑:将其返回到 MAMP 环境中,同样的问题。现在正在研究配置。
I'm taking over a codeigniter project that was originally developed in MAMP on OSX.
My php dev environment is a XAMPP on Windows. Works great for all my other work and projects. However I copied this app I took over to my htdocs folder and it works but it causes lots of problems with rewriting URLS (for example ModRewrite isn't working when it is suppose to, see ModRewrite not working for codeigniter site).
Could these problems stem from the two dev environments? It works fine when on my host, but I need to make changes.
EDIT: Got it back on a MAMP environment, same exact problem. Looking into config now.
发布评论
评论(2)
好的,CodeIgniter 特定的环境配置问题...
要检查的内容是 config.php 中的“base_url”
另外,在这一点上,请确保前作者在代码中始终使用
< /code> 用于加载资源(css、img 等)和其他依赖路径的东西。
包含 css 文件的示例 url
<= base_url() ?>css/cssfile.css
将创建 urlhttp://your.local.host/css/cssfile.css
和
将创建
http://your.local.host/index.php/controller/function< /code>
确保锚标记使用
作为 href。
ok, CodeIgniter specifc environment config issues...
Things to check are 'base_url' in config.php
Also on this note, make sure in the code the previous author consistently used
<?= base_url() ?>
for loading assets(css,img,etc..) and other path dependant things.example url to include a css file
<= base_url() ?>css/cssfile.css
would create the urlhttp://your.local.host/css/cssfile.css
and
<?= site_url('controller/function') ?>
would createhttp://your.local.host/index.php/controller/function
make sure for anchor tags they used
<?= site_url('uri/path') ?>
for the href.1 检查站点路径如何,例如。它是 locahost/~user/ci ,
如果不同则为 localhost/ci 2 更改 config.php 和 .htaccess
3 确保 htaccess 正常工作。检查模块是否存在并检查 httpd.conf 上是否允许 .htaccess
看看 Mamp 到 Xampp 有何不同。
1 Check how sitepath is, eg. it was locahost/~user/ci and is localhost/ci
2 if is different Change both config.php and .htaccess
3 make sure that htaccess works. CHeck if module is there and check if allow .htaccess on httpd.conf
See what is different from Mamp to Xampp.