0

Facebook ユーザーがページを気に入らないかどうかを確認しています。その場合、コードはユーザーの名前と「いいね!」への招待メッセージを表示します。そうでない場合は、「インセンティブ ランディング ページ」が表示されます。ただし、最初の部分だけはわかります。ユーザーが [いいね] ボタンを押しても、コードには「インセンティブ」が表示されません。コードは次のようになります。

<?php if(!$like_status): ?> 
    <?php if ($me): ?>
      <div id="name">Hola <?php echo $me['first_name']; ?></div> //Everything works fine.  
    <?php endif; ?>
     // Display graphics... Everything works fine.
<?php else : ?>
     //Page with the incentive... This does not work when the nested if is present.
<?php endif; ?>

ネストされた if (ユーザーの名前を表示するもの) を取り除くと、すべて正常に動作します。何か案は?

4

2 に答える 2

1

endif の後にセミコロンがありません

<?php if(!$like_status): ?>   
    <?php if ($me): ?>
      // Display user's name... Everything works fine.  
    <?php endif; ?>
     // Display graphics... Everything works fine.
<?php else: ?>
     //Page with the incentive... This does not work when the nested if is present.
<?php endif; ?>
于 2011-07-19T03:19:27.880 に答える
0

誰かが同じ問題に直面している場合に備えて、解決策を見つけました。何らかの理由で、IE 7-8 は変数 $me と同じコンテキストでの API('/me') の呼び出しを好みません。変数の名前を変更しただけで、FF、Chrome、および IE 7-9 ですべて正常に動作します。

于 2011-07-26T00:48:52.330 に答える