Cannot turn off short_open_tag with ini_set

后端 未结 3 1905
我在风中等你
我在风中等你 2020-12-19 12:35

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

相关标签:
3条回答
  • 2020-12-19 13:16

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

    0 讨论(0)
  • 2020-12-19 13:21

    I see no connection between your highlighter and turning short open tags off.

    If some of your code gets confused with short tags, you have to rewrite your code manually, replacing short tags with long ones. Or at least run some code to do it.
    But no configuration setting will do it for you.

    Also, I see no way for JavaScript code to read PHP file source with all these whatever short or long tags.

    It seems your problem is somewhere else.

    0 讨论(0)
  • 2020-12-19 13:31

    According to a comment on this manual page:

    libkhorse at gmail dot com 06-Aug-2009 07:14:

    For 'short_open_tag', though it is marked as PHP_INI_ALL in changable column, you should note the CHANGE_LOG column also:

    PHP_INI_ALL in PHP <= 4.0.0. PHP_INI_PERDIR in PHP < 5.3.0

    So as of 4.0, it will not work if you wanna use ini_set('short_open_tag') to change it's value on the fly.

    Try using .htaccess instead:

    php_flag short_open_tag off 
    
    0 讨论(0)
提交回复
热议问题