什么是PHP文件中的<%以及它应该如何编译?

问题描述:

I have new sample.php file that is it active on a cpanel (Apache server) and it is work correctly on that cpanel, I don't know how it is working! because it is PHP file but it is using <% instead of <?PHP in it's php syntax and %> instead of ?> and <%= instead of <?PHP echo.


can you tell me what is the <% and how I can enable it in my cpanel?

我有一个新的sample.php文件,它在cpanel(Apache服务器)上是活动的,并且它可以正常工作 那个cpanel,我不知道它是如何工作的! 因为它是PHP文件,但它使用&lt;% code>而不是&lt;?PHP code>在它的php语法和%&gt; code>而不是?&gt; code>和&lt;%= code>而不是&lt;?PHP echo code>。


你能告诉我什么 是&lt;%以及如何在我的cpanel中启用它? p> div>

<% are called "asp-style tags".

If you have access to the php.ini, set asp_tags = Off or asp_tags = 0 to asp_tags = On or asp_tags = 1 respectively.

To temporarily enable asp-tags for a script, you can add <?php ini_set('asp_tags',1) ?> to the beginning of the file, but this is less than ideal.

The alternative would be to replace each <% with <?php and each %> with ?>. If you are using short_tags, you can replace <%, %>, and <%= with <?, ?>, and <?=, respectively.