我有this.php:在.php文件中使用<?php作爲純文本?
<?php
//some code
?>
Here goes the text that is plain text.
Whenever you use <?php in a .php file it precedes the php code that will be parsed and interpreted by php.
正如你可能已經猜到了,這個文件給出了一個錯誤,並拒絕正常運行。我不想使用HTML實體,因爲結果文件不被用作HTML。除了將字符串<?php
存儲在一個變量中,我有什麼選擇嗎?
如果結果不應該作爲HTML使用,那麼對PHP代碼使用'<?php',一次使用「plain」是不明確的。不管你使用的結果是不支持任何類型的轉義序列嗎? – deceze 2014-09-10 14:23:22
@deceze,不只是純文本,我從PHP本身生成PHP代碼。 – 2014-09-10 14:28:22
哇哇的人,代碼! ; o) – deceze 2014-09-10 14:30:33