问题解答 编程专区>>问题解答
    【问题所属栏目】- 编程专区
  Q:PHP 的开始和结束标志
  A:一个令人混淆的东西,到底是用”〈?php ?〉“还是”〈? ?〉“来标志php代码?答案原来在php文档的最前面。

    Example #2 PHP Opening and Closing Tags

    1. 〈?php echo ’if you want to serve XHTML or XML documents, do like this’; ?〉
    2. 〈script language=“php“〉
         echo ’some editors (like FrontPage) don\’t like processing instructions’;
       〈/script〉
    3. 〈? echo ’this is the simplest, an SGML processing instruction’; ?〉
       〈?= expression ?〉 This is a shortcut for “〈? echo expression ?〉“
    4. 〈% echo ’You may optionally use ASP-style tags’; %〉
       〈%= $variable %〉 This is a shortcut for “〈% echo $variable %〉“While the tags seen in examples one and two are both always available, example one is the most commonly used, and recommended, of the two.

    Short tags (example three) are only available when they are enabled via the short_open_tag php.ini configuration file directive, or if php was configured with the --enable-short-tags option.

    ASP style tags (example four) are only available when they are enabled via the asp_tags php.ini configuration file directive.

    Note: Using short tags should be avoided when developing applications or libraries that are meant for redistribution, or deployment on PHP servers which are not under your control, because short tags may not be supported on the target server. For portable, redistributable code, be sure not to use short tags.
     去电脑《问吧!》提问:

     [文章来源:“十万个为什么”电脑学习网]
     [网址:http://why100000.com]
     [特别声明:除本站部分特别声明禁止转载的专稿外,其他的文章可以自由转载,但请务必注明出处和原始作者。本站文章版权归文章原作者所有。如果本站转载的文章有版权问题请联系我们,我们会尽快予以更正。]
   [人气:129]   [更新时间:2010-7-17 15:22:40]   [最后访问时间:2010-9-10 18:09:20]  

【字体:[大] [中] [小] 【加入收藏】 【发表评论】 【关闭本窗口】 收藏此页到365Key】  

Copyright © “十万个为什么”电脑学习网 2000-2007 陕ICP备06007929号
站务联系:MSN & Email:zhangking2008@gmail.com  QQ:9365822