Re: PHP ECHO 出HTML碼問題

看板PHP作者 (涼宮春日症候群)時間17年前 (2006/11/04 12:22), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/3 (看更多)
※ 引述《ago1414 (自己也要知道肥!!)》之銘言: : ※ 引述《showsky (小小世界)》之銘言: : : 今天我寫了一個 : : $pic1 = "<img : : src=\"./php_system/update/epaper_cultures/ : : $row_epaper_cultures['cultures_path1']\" : : width=\"500\" />"; : : 發現錯誤我因該如何改才對想了好久還是想不到麻煩各位址點一下 : <?php : $pic1='<img src=' .'/php_system/update/epaper_cultures/'. : "$row_epaper_cultures[cultures_path1]"." width=500 >"; : echo $pic1; : ?> : 這樣應該可以 : 有的地方要放變數 有的地方直接當字串印 : 最後要符合 HTML 就對了 : 應該是這樣 試看看 其實不用這麼麻煩 $pic1='<img src="./php_system/update/epaper_cultures/' .$row_epaper_cultures['cultures_path1'].'" width="500" />'; 善用字串連接的 . 運算子 儘量不要把變數內嵌在字串當中 比較難讓人看懂 又容易碰到像原PO這樣的錯誤 -- 'Oh, Harry, dont't you see?' Hermione breathed. 'If she could have done one thing to make absolutely sure that every single person in this school will read your interview, it was banning it!' ---'Harry Potter and the order of the phoenix', P513 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 192.192.197.112 ※ 編輯: LPH66 來自: 192.192.197.112 (11/04 19:51)
文章代碼(AID): #15J1ML08 (PHP)
文章代碼(AID): #15J1ML08 (PHP)