时间:2021-07-01 10:21:17 帮助过:7人阅读
jsonp3({ "status": 200, "ercode": 0});
$s = 'jsonp3({ "status": 200, "ercode": 0})';php5.3及以上可写作
preg_replace('/^\w+?\((.+)\)$/ise', 'count($r=json_decode("$1"))', $s);
print_r($r);
$s = 'jsonp3({ "status": 200, "ercode": 0})';
preg_replace_callback('/^\w+?\((.+)\)$/is', function($m) use (&$r) { $r = json_decode($m[1]); }, $s);
print_r($r);