Codeigniter - PHP 未在带有 mod_php 5 的视图中呈现
我最近将我的一个网站转移到一台私人服务器,这使我可以使用 mod_php 5 和 XCache。但是,当我从 PHP 5 CGI 切换到 mod_php 时,直接位于视图文件中的 PHP 不会被渲染。例如,我的页面标题是“”。如图所示,您可以在 HTML 中看到未处理的代码。关于为什么会发生这种情况有什么想法吗?
谢谢!
I recently transferred one of my websites to a private server which allowed me to use mod_php 5 along with XCache. However, when I switch from PHP 5 CGI to mod_php, the PHP that is directly in my view files is not being rendered. For example, the title of my page is “”. As in you can see the unprocessed code in the HTML. Any ideas as to why this is happening?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否有可能在视图文件中使用短标签?
更改
为
如果这工作量太大,则有一个配置选项:
除此之外我们很难说。您能否在您的配置文件中提供一个您遇到问题的视图示例?
Any possibility you are using short-tags in your view files?
Change
to
If that is too much of a job there is a config option:
Other than that it's hard for us to tell. Could you peraps pastie in your config file and an example of a view you have having trouble with?
我猜你的模板没有使用 .php 扩展名(你可能使用 .tpl 或 .phtml),你需要在 apache 中设置正确的处理程序,以便这些文件由 php 模块解析。
像这样的东西应该可以解决问题(只添加 apache 配置中缺少的内容,不要复制粘贴所有内容)
I guess your templates aren't using the .php extension (you probably use .tpl or .phtml), you need to set up the correct handler in apache, so that those files get parsed by the php module.
Something like this should do the trick (only add what is missing in your apache configuration, don't copy paste everything)