1
skydiver 2014-08-04 11:56:56 +08:00 via iPad
substring
json decode |
3
wingoo 2014-08-04 11:57:44 +08:00
先replace,再json_decode
|
5
MaiCong 2014-08-04 12:13:01 +08:00
<?php
$str = 'callback({"client_id":"YOUR_APPID","openid":"YOUR_OPENID"});'; $lpos = strpos($str, "("); $rpos = strrpos($str, ")"); $str = substr($str, $lpos+1, $rpos-$lpos-1); $json = json_decode($str); // print_r($json); $openid = $json->openid; echo $openid; |
6
feiyuanqiu 2014-08-04 12:33:22 +08:00
这个其实是qq准备让你用js来运行的...
```php $callback = 'callback( {"client_id":"YOUR_APPID","openid":"YOUR_OPENID"} )'; if (preg_match('/\"openid\":\"(\w+)\"/i', $callback, $match)) { $openid = $match[1]; } var_dump($openid);exit; ``` 略菜...勿喷 |
7
csensix OP @feiyuanqiu 赞一个,已经做好功能了。
|
8
zts1993 2014-08-04 13:19:32 +08:00
jsonp
|
9
belin520 2014-08-04 13:58:34 +08:00
jsonp
|