问题描述
我在PHP脚本中嵌入了一个JavaScript语法荧光笔,用于读取源文件并回传。 js荧光笔在一行上有此字符串:
... [z,/ ^ [^
此服务器上的short_open_tag已打开,<?
该字符串混淆脚本并导致错误。我不能在php.ini或其他地方关闭。
我使用了 ini_set('short_open_tag','0');
在同一个脚本,但它不生效。可能的问题是什么?
编辑
什么Col Shrapnel在评论中建议: 'short_open_tag'在PHP中被标记为PHP_INI_PERDIR
我更改了 [z,/ ^ [^ 到
[z,f ^ [^
改变它与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'tchange it with ini_set().
这篇关于无法使用ini_set关闭short_open_tag的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!