mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
规范 JSONP 和 EVAL 的 ContentType 类型
This commit is contained in:
@@ -91,12 +91,12 @@ class Controller {
|
|||||||
exit(xml_encode($data));
|
exit(xml_encode($data));
|
||||||
case 'JSONP':
|
case 'JSONP':
|
||||||
// 返回JSON数据格式到客户端 包含状态信息
|
// 返回JSON数据格式到客户端 包含状态信息
|
||||||
header('Content-Type:application/json; charset=utf-8');
|
header('Content-Type:application/javascript; charset=utf-8');
|
||||||
$handler = isset($_GET[C('var_jsonp_handler')]) ? $_GET[C('var_jsonp_handler')] : C('default_jsonp_handler');
|
$handler = isset($_GET[C('var_jsonp_handler')]) ? $_GET[C('var_jsonp_handler')] : C('default_jsonp_handler');
|
||||||
exit($handler . '(' . json_encode($data) . ');');
|
exit($handler . '(' . json_encode($data) . ');');
|
||||||
case 'EVAL':
|
case 'EVAL':
|
||||||
// 返回可执行的js脚本
|
// 返回可执行的js脚本
|
||||||
header('Content-Type:text/html; charset=utf-8');
|
header('Content-Type:application/javascript; charset=utf-8');
|
||||||
exit($data);
|
exit($data);
|
||||||
default:
|
default:
|
||||||
// 用于扩展其他返回格式数据
|
// 用于扩展其他返回格式数据
|
||||||
|
|||||||
Reference in New Issue
Block a user