iT邦幫忙

0

facebook 開發程式php與法問題

php

我是參考網路上別人寫的範例去做的
可是卻顯示錯誤
( ! ) Parse error: syntax error, unexpected $end in C:\AppServ\www\Compliments\examples\index.php on line 144
至於登入fb和api id 密碼等 我都設定好了

<?php if ($_POST['choice']) {
    if ($_POST['choice'] == '3') {
        $msg="答對了";
    } else {
        $msg="答錯了";
    }
}
?>
<form method="post" action="test.php" name="test1" id="test1">
<div>

<div>
  <input type="radio" name="choice" value="1" onclick="document.getElementById('test1').submit();" />
  努力工作的,勤勉的</div>

<div><input type="radio" name="choice" value="2" onclick="document.getElementById('test1').submit();">…的,…所有的</div>

<div><input type="radio" name="choice" value="3" onclick="document.getElementById('test1').submit();">水</div>

<div><input type="radio" name="choice" value="4" onclick="document.getElementById('test1').submit();">粉筆</div>

</div>
</form>

<?php if (!empty($msg) ) { //這段的意思就是只要答題,那麼就跳一個視窗出來問要不要publish 到 wall,這是facebook提供的javascript 函式,不用想太多,就用下去就會有效果

?>
<script>
var actionLinks = [{ "text": "想瞭解facebook ap的開發?到inside.com.tw", "href": "http://www.inside.com.tw"}];
Facebook.streamPublish('<?php echo $msg;?>',
'',
 actionLinks,
'',
'剛剛答題的結果如下:',
'',
true
);</script>

<?php } ?>
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

6
wonton
iT邦高手 6 級 ‧ 2010-12-17 09:05:35
最佳解答

就打開你的 C:\AppServ\www\Compliments\examples\index.php 跳到 144 行,然後找到 $end 變數,前面一定有一個語法錯了,或許是字串串接沒有加到逗點,如

"blah blah".$end 的 . 不見了變成 "blah blah"$end

8
fillano
iT邦超人 1 級 ‧ 2010-12-16 12:01:16

...錯誤訊息說的index.php的144行是啥?你貼的程式沒看不出來有那一行,而且這樣肉眼debug不準啦。

你有先查錯誤訊息的來源嗎?

我要發表回答

立即登入回答