求解哪里错了

@Ta 2014-01-18 2769点击
<html>
<head>
<meta http-equiv='content-type' content='text/html; charset=UTF-8' />

<meta http-equiv='content-language' content='zh-CN' />
<title>留言成功</title>
<body>
感谢您的留言建议!
<hr/>
<?php 
$name="echo $_POST[\"name\"]; ";
$nr="echo $_POST[\"nr\"]; ";
$file=fopen("test.txt","w");
 echo fwrite($file,"$name"); 
fclose($file);

?>
</body>
</html>
回复列表(7|隐藏机器人聊天)
  • @Ta / 2014-01-18 / /
    Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /data/sdext2/android.wwwroot/view.php on line 11
  • @Ta / 2014-01-18 / /
    <?php
    $name=$_POST[\"name\"]; 
    $nr=$_POST[\"nr\"]; 
    $file=fopen("test.txt","w");
     echo fwrite($file,"$name");
    fclose($file);
    ?>
    
    @叶小新
  • @Ta / 2014-01-18 / /
    @爱小邹,哦,我知道了
  • @Ta / 2014-01-18 / /
    还有把转意的 \去掉看看吧
  • @Ta / 2014-01-19 / /
    @叶小新,你的错在于$nsme= "echo $_POST[\"name\"];"这样的形式!存在你对php中语法,单隐号和双隐号的不理解
  • 666
    @Ta / 2014-01-19 / /
    post前面echo去掉
  • @Ta / 2014-01-19 / /
    $ name="echo $_POST[\"name\"]; ";
    这里echo 是字符串,$_POST[\"name\"]是变量,;是字符串,就语法而言是错的,因为你没做处理,你可以这样 $name="echo {$_POST["name"]}; ";或者$ name="echo ".$_POST["name"]."; ";
添加新回复
回复需要登录