开发者

Shorthand <? issue

开发者 https://www.devze.com 2023-03-22 12:16 出处:网络
I want to use the CakePHP shorthand <? in my project code instead of <?php, but my WAMP server (v2.1d-x64 on localhost) doesn\'t recognize it.

I want to use the CakePHP shorthand <? in my project code instead of <?php, but my WAMP server (v2.1d-x64 on localhost) doesn't recognize it.

How can I开发者_如何学Python activate it?


In your php.ini, turn short_open_tag to on.

This is not recommended for portability reasons. My advice is to stick with the longer version.


In you php.ini, add the following line:

short_open_tag On

Note that in your question, that's not what you've done.. There should be no "Default Value: On", just short_open_tag On on a line by itself.


This is PHP syntax, not part of your CakePHP framework. You need to edit your PHP configuration file (php.ini), change short_open_tag to 1, and restart Apache.

http://php.net/manual/en/ini.core.php


You can activate it in your php.ini file. But good practice is to use the full string (<?php ... ?>). Not every PHP configuration allows the shorthand, and you do not have access to every server's php.ini (that is, if you host in a shared environment).


Set the configuration parameter short_open_tag to On in your php.ini file and restart your Apache server.

0

精彩评论

暂无评论...
验证码 换一张
取 消