在没有 php.ini 文件的情况下启用短打开标签
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2287076/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Enable short open tag without php.ini file
提问by rajanikant
Can I enable PHP short tags without touching any configuration files?
我可以在不接触任何配置文件的情况下启用 PHP 短标签吗?
回答by Erik Giberti
You should be able to change it in your .htaccess file if it wasn't locked down
如果它没有被锁定,你应该能够在你的 .htaccess 文件中更改它
<IfModule mod_php5.c> php_value short_open_tag 1 </IfModule>
See http://php.net/manual/en/configuration.changes.phpfor more details
有关更多详细信息,请参阅http://php.net/manual/en/configuration.changes.php
回答by Alexandru Mos
I think the short_open_tagcan't be modified with ini_set().
我认为short_open_tag不能用 ini_set() 修改。
回答by Antonio Barrera
If you have access to an .htaccess but not the php.ini, simply add this to .htaccess in root of the php app you are planning on running:
如果您有权访问 .htaccess 但不能访问 php.ini,只需将其添加到您计划运行的 php 应用程序根目录中的 .htaccess 中:
php_value short_open_tag 1
回答by Joko Wandiro
Checkout this previous Questions:
How to enable PHP short tags - Manual Setting
查看之前的问题:
如何启用 PHP 短标签 - 手动设置
You can use ini_set functionfor setting programmatically
您可以使用ini_set 函数以编程方式进行设置
Revised:I try using ini_set functionto configure it but failed. You can check previous questions for better answer.
修改:我尝试使用ini_set 函数来配置它但失败了。您可以查看以前的问题以获得更好的答案。
回答by phponwebsites
Add into your .htaccess file,
添加到您的 .htaccess 文件中,
php_value short_open_tag 1

