Re: [閒聊] 純PHP開頭跟結尾的檔案沒有加?> 以及 < …
※ 引述《qazsd (Be brave & outstanding)》之銘言:
: test.php
: <?php
: echo 'hello';
: ----檔案完畢(最後面沒有加?>)
: 一樣是可以執行,但是不清楚會不會有什麼影響或是潛在的bug
節錄自ZF的手冊的一段話(code standard)
http://framework.zend.com/manual/en/coding-standard.php-file-formatting.html
For files that contain only PHP code, the closing tag ("?>") is never
permitted. It is not required by PHP, and omitting it prevents the accidental
injection of trailing whitespace into the response.
: 另外 <?= 這個用法有PHP或是其他東西版本的限制嗎
: 就是說安裝的是某幾版以上的PHP 才能執行
: 就像PHP 5以上就都得寫<?php 而不能寫 <? 一樣
這個請自行參閱php.ini裡的說明 :)
--
誠徵PHP網站工程師,熟MVC架構佳 http://blog.eddie.com.tw/
全職、兼職可,意者請敲 :) http://www.eddie.com.tw/
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.132.128.37
※ 編輯: aquarianboy 來自: 220.132.128.37 (09/10 14:28)
→
09/10 14:29, , 1F
09/10 14:29, 1F
推
09/10 15:47, , 2F
09/10 15:47, 2F
→
09/10 16:10, , 3F
09/10 16:10, 3F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章