Re: [請益] heredoc synex 在php5裡有支援嗎?
※ 引述《johnney (You make me Complete!)》之銘言:
: <?php
: echo <<<heredoc
: 測試<br>
: 測試0
: heredoc; // 前面不能有任何字元
: ?>
請問如果裡面夾雜函數和陣列怎麼寫?
ex1:
echo <<<heredoc
<h1>htmlspecialchars($row["subject"])</h1>
heredoc; //ex1會有錯誤
如果$a=$row["subject"]; //if $a='123'
ex2:
echo <<<heredoc
<h1>htmlspecialchars($a)</h1>
heredoc; //ex2輸出為 <h1>htmlspecialchars(123)</h1>
如果$b=htmlspecialchars($row["subject"]);
ex3:
echo <<<heredoc
<h1>$b</h1>
heredoc; //ex3可以正常,函式的功能也有作用到
請問有別的寫法嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.132.202.165
推
01/20 17:25, , 1F
01/20 17:25, 1F
推
02/26 13:16, , 2F
02/26 13:16, 2F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 3 篇):