我有一个回显 JavaScript 的 php 脚本,在 JavaScript 中有 PHP 变量
echo '<script type="text/javascript">
FB.init({
appId: "myid",
channelUrl: "//mysite/channel.html",
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true // parse XFBML
});
FB.getLoginStatus(function (response) {
if (response.status === "connected") {
FB.api("me/bookvote:download", "post", {
book: "<?php echo "http://mysite/auction_details.php?name=$item_details["name"]&auction_id=$item_details["auction_id"]";?>",
fb:explicitly_shared = "true" //? Is syntactically valid but creates a global
}, //Missing a , here?
但是,我仍然得到:
Uncaught SyntaxError: Unexpected identifier for book: http://mysite.xom/auction_details.php?name=$item_details["name"]&auction_id=$item_details["auction_id"]";?>",
我该怎么办?