Re: [請益] heredoc synex 在php5裡有支援嗎?

看板PHP作者 (XHTML&CSS&JS&PHP)時間18年前 (2006/01/20 16:47), 編輯推噓2(200)
留言2則, 2人參與, 最新討論串3/3 (看更多)
※ 引述《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
基本變數轉換還可以 work...難一點的函數、陣列恐怕不行
01/20 17:25, 1F

02/26 13:16, , 2F
可以使用 {} 把變數包起來看看
02/26 13:16, 2F
文章代碼(AID): #13qAEVSr (PHP)
文章代碼(AID): #13qAEVSr (PHP)