无法使用ini_set关闭short_open_tag [英] Cannot turn off short_open_tag with ini_set

查看:419
本文介绍了无法使用ini_set关闭short_open_tag的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PHP脚本中嵌入了一个JavaScript语法荧光笔,用于读取源文件并回传。 js荧光笔在一行上有此字符串:



... [z,/ ^ [^ <?] + /] ..



此服务器上的short_open_tag已打开,<?该字符串混淆脚本并导致错误。我不能在php.ini或其他地方关闭。



我使用了 ini_set('short_open_tag','0'); 在同一个脚本,但它不生效。可能的问题是什么?



编辑



什么Col Shrapnel在评论中建议:

我更改了 [z,/ ^ [^ <?] + /], [z,f ^ [^ <?php echo'<'。'?

'short_open_tag'在PHP中被标记为PHP_INI_PERDIR

; 5.3.0,这意味着你不能
改变它与ini_set()。


I'm embedding a javascript syntax highlighter to a PHP script that reads source file and echos it back. The js highlighter has this string on one line:

... [z,/^[^<?]+/], ...

The short_open_tag is on on this server and the <? in the string confuses the script and causes errors. I cannot turn off in php.ini or elsewhere.

I have used ini_set('short_open_tag', '0'); in the same script, but it does not take effect. What could be the problem?

Edit

In the end, I used what Col Shrapnel suggested in a comment:
I changed [z,/^[^<?]+/], to [z,/^[^<?php echo '<' .'?'; ?>]+/],

解决方案

'short_open_tag' is marked as PHP_INI_PERDIR in PHP <5.3.0, which means you can't change it with ini_set().

这篇关于无法使用ini_set关闭short_open_tag的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆