錯誤一:
echo 'echo $rst4[$i]["tb_restore_content"]:
';echo $rst4[$i]['tb_restore_content']."
";echo 'echo $rst4[$i]["tb_restore_content"]的內容:
';echo '【回複:sasasa】 【回複:sasasa】 0
1
2 ';
運行結果
由於直接輸出變數a時有些標籤沒有被解析,由於有給它加了雙引號,又出現了以下錯誤
錯誤二
echo is_string($rst4[$i]['tb_restore_content']);echo "$rst4[$i]['tb_restore_content']";
結果
回複討論(解決方案)
為什麼呢,看不出來,找出原因了嗎?
是很神奇!
對於錯誤一,神奇在於你沒把問題說清楚
對於錯誤二,神奇在於你沒按 php 書寫規則書寫
echo "$rst4[$i]['tb_restore_content']";
應寫作
echo "{$rst4[$i]['tb_restore_content']}";
或
echo $rst4[$i]['tb_restore_content'];
是很神奇!
對於錯誤一,神奇在於你沒把問題說清楚
對於錯誤二,神奇在於你沒按 php 書寫規則書寫
echo "$rst4[$i]['tb_restore_content']";
應寫作
echo "{$rst4[$i]['tb_restore_content']}";
或
echo $rst4[$i]['tb_restore_content'];
對,我一時間還沒注意到
為什麼呢,看不出來,找出原因了嗎?
錯誤二好你所說,錯誤一的意思是一個字串中有標籤,但是我輸出這個變數時它不解析,
是很神奇!
對於錯誤一,神奇在於你沒把問題說清楚
對於錯誤二,神奇在於你沒按 php 書寫規則書寫
echo "$rst4[$i]['tb_restore_content']";
應寫作
echo "{$rst4[$i]['tb_restore_content']}";
或
echo $rst4[$i]['tb_restore_content'];
錯誤二好你所說,錯誤一的意思是一個字串中有標籤,但是我輸出這個變數時它不解析
那你把問題仔細的描述一下
如果涉及變數,要分別給出變數的值
是很神奇!
對於錯誤一,神奇在於你沒把問題說清楚
對於錯誤二,神奇在於你沒按 php 書寫規則書寫
echo "$rst4[$i]['tb_restore_content']";
應寫作
echo "{$rst4[$i]['tb_restore_content']}";
或
echo $rst4[$i]['tb_restore_content'];
錯誤二好你所說,錯誤一的意思是一個字串中有標籤,但是我輸出這個變數時它不解析
0
那你把問題仔細的描述一下
如果涉及變數,要分別給出變數的值
比如
$a='【回複:sasasa】 0 2'
echo $a輸出的是沒有解析的字串,還是,div還是div
echo '【回複:sasasa】 0 2'
則沒有任何問題
有什麼不對嗎?