mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
Update Jsonp.php (#185)
当url_common_param为false时是无法获取到$_GET的数据的,故使用Request来获取
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace think\response;
|
namespace think\response;
|
||||||
|
|
||||||
|
use think\Request;
|
||||||
use think\Response;
|
use think\Response;
|
||||||
|
|
||||||
class Jsonp extends Response
|
class Jsonp extends Response
|
||||||
@@ -32,8 +33,9 @@ class Jsonp extends Response
|
|||||||
*/
|
*/
|
||||||
protected function output($data)
|
protected function output($data)
|
||||||
{
|
{
|
||||||
// 返回JSON数据格式到客户端 包含状态信息
|
// 返回JSON数据格式到客户端 包含状态信息 [当url_common_param为false时是无法获取到$_GET的数据的,故使用Request来获取<xiaobo.sun@qq.com>]
|
||||||
$handler = !empty($_GET[$this->options['var_jsonp_handler']]) ? $_GET[$this->options['var_jsonp_handler']] : $this->options['default_jsonp_handler'];
|
$var_jsonp_handler = Request::instance()->param($this->options['var_jsonp_handler'], "");
|
||||||
|
$handler = !empty($var_jsonp_handler) ? $var_jsonp_handler : $this->options['default_jsonp_handler'];
|
||||||
$data = $handler . '(' . json_encode($data, $this->options['json_encode_param']) . ');';
|
$data = $handler . '(' . json_encode($data, $this->options['json_encode_param']) . ');';
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user