2010-09-14 124 views
0
$XMLFormatedString .= "<Filter id='" .= .$row->id. .="' name='" .= .$row->label. .="'><Label>" .= .$row->label. .="</Label></Filter>"; 
+1

-1,你的問題在哪裏? T_CONCAT_EQUAL的意思是'。=',你知道嗎? – greg0ire 2010-09-14 19:43:18

+1

對我有意義的問題,+1 – Adam 2010-09-14 19:46:00

+0

@亞當:不是「你好」,沒有句子,沒有問號......它對我來說也很有意義,但我覺得它很粗魯。 – greg0ire 2010-09-14 20:24:38

回答

1

您有多個語法錯誤:

.= "<Filter id='" .= .$row->id. 

應該是:

.= "<Filter id='".$row->id. 

等等

3

左手邊像.=這樣的assignment operator需要是一個變量。但在這種情況下,"<Filter id='"不是一個變量。

我猜你的意思是正常string concatenation operator .

$XMLFormatedString .= "<Filter id='" . $row->id . "' name='" . $row->label . "'><Label>" . $row->label . "</Label></Filter>"; 
5

你不能鏈=操作類似。在這種情況下,它也不是必需的,你可以使用。運營商之後的第一個:

$XMLFormatedString .= "<Filter id='" .$row->id. "' name='" .$row->label."'><Label>" .$row->label."</Label></Filter>"; 

也無論你想要做什麼,它看起來像一個壞主意。你應該使用類似於PHP DOMDocument的東西來編寫XML。

+0

+1。特別是對於DomDocument位......但是fyi:你可以鏈接'。='運算符。 '$ f ='f'; $ o ='o'; $ f。= $ o。='obar';'以'$ f =='foobar''和'$ o =='oobar''結尾。但是你不能在'。='左邊的任何地方有一個靜態字符串(非變量)... – ircmaxell 2010-09-14 20:16:01

相關問題