找不到语法错误 [英] can't find what is wrong in the syntax

查看:104
本文介绍了找不到语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

onclick=" <?php echo 'postwith(\''.$_SERVER['PHP_SELF'].'\',{export:\'export\',date:\''.$_POST['date'].'\'})'; ?>"

而postwith是一个函数.

while postwith is a function.

在即我有一个错误: Expected identifier, string or number

in ie i have an error: Expected identifier, string or number

在Firefox中可以,链接为:

in firefox it's ok and the link is:

postwith('/page/page.php',{export:'export',date:'Yesterday'})

那我的错误在哪里?

谢谢!

推荐答案

沃伦(Warrenm)指出export是关键字,需要加引号.

As warrenm pointed out export is a keyword and needs to be quoted.

也就是说,更改PHP,使结果输出为:

That is, alter the PHP so the result output is:

postwith('/page/page.php',{'export':'export','date':'Yesterday'});

您的PHP将如下所示:

Your PHP would look like this:

onclick="<?php echo "postwith('{$_SERVER['PHP_SELF']}',
     {'export':'export','date':'{$_POST['date']}'})"; ?>"

(谢谢Peter的改进语法).

(Thanks, Peter for the improved syntax).

此外,您可能希望在单击后删除空格:

Also, you may wish to remove the space after onclick:

onclick=" <?php 

将变为:

onclick="<?php 

这篇关于找不到语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆