-1

'index.php'という名前のファイルにコンテンツを入れていますが、コードは次のとおりです。

$put=<<<DEMO
<div id='container' style='width:100%'>
<style>
h1 {font-size:45px;}
</style>
<div id='header' style='background-color:#FFFFFF;'>
<h1 style='margin-bottom:0;margin-top:0;height:20%;float:center;'>
while($row = mysql_fetch_array($result))
{

108行目

<table align='left'><tr><td><img src="$row['Website_Name']/index.jpg" align='center' width='240' height='170'></td></tr></table>
 <table align='center'><br><tr><td><h1>$row['Business_Name']</td></tr></table>
 }

</h1></div>
</div>

DEMO;
file_put_contents("$str/index.php","$put");

しかし、ブラウザでコードを実行すると、エラーが発生します。

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in E:\Program Files\xampp\htdocs\registration.php on line 108
4

1 に答える 1

1

あなたの問題は、変数補間構文です。どちらかです

"$var[foo]"

また

"{$var['foo']}"

いいえ

"$var['foo']"

読む: http://php.net/manual/en/language.types.string.php#language.types.string.parsing .

于 2013-02-16T14:21:11.450 に答える