<?php
$ar = (object) array('a'=>function(){
echo 'TEST';
});
$ar->a();
?>
Run Code Online (Sandbox Code Playgroud)
我得到此错误调用未定义的方法
我正在调用API来使用fetch API从服务器下载excel文件,但它没有强制浏览器下载,下面是我的标题响应:
HTTP/1.1 200 OK Content-Length: 168667
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Server: Microsoft-IIS/8.5
Content-Disposition: attachment; filename=test.xlsx
Access-Control-Allow-Origin: http://localhost:9000
Access-Control-Allow-Credentials: true
Access-Control-Request-Method: POST,GET,PUT,DELETE,OPTIONS
Access-Control-Allow-Headers: X-Requested-With,Accept,Content-Type,Origin
Persistent-Auth: true
X-Powered-By: ASP.NET
Date: Wed, 24 May 2017 20:18:04 GMT
Run Code Online (Sandbox Code Playgroud)
在我用来调用API的代码下面:
this.httpClient.fetch(url, {
method: 'POST',
body: JSON.stringify(object),
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
})
Run Code Online (Sandbox Code Playgroud)