如果我尝试将此 URL 传递到 Open Graph
$url = 'http://abc.com/index.php';
$facebook->api('/me/url_app:action','POST', array('something'=>$url));
一切正常。但是如果我尝试添加一些参数,比如
$url = 'http://abc.com/index.php?a=b&c=d';
$facebook->api('/me/url_app:action','POST', array('something'=>$url));
然后我会收到这个错误
Fatal error: Uncaught Exception: Object at URL 'http://abc.com/index.php?a=b&c=d' of type 'url_app:action' is invalid because the given value '' for property 'og:url' could not be parsed as type 'url'. thrown in _PATH_/base_facebook.php on line 1050
为什么我不能在 URL 地址中添加一些参数?
编辑另外,这里是编码链接的 PHP 函数:
function encodeURIComponent($str) {
$revert = array('%21'=>'!', '%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')', '%3D'=>'=', '%3F'=>'?');
return strtr(rawurlencode($str), $revert);
}