标签:XML tp5 eth http main you ted col span
header(‘Access-Control-Allow-Origin: *‘); header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept"); header(‘Access-Control-Allow-Methods: POST,GET‘);
在router/router.php头上写上上面的header头就可以正常调用了。
解决办法:
给请求头添加 X-Requested-With 这个参数,参数值为 XMLHttpRequest
// 以 axios 为例 this.$axios.get(‘http://yourdomain.com/api/getMenus‘, { headers: {‘X-Requested-With‘: ‘XMLHttpRequest‘} }).then((res)=>{ // console.log(res.data); })
标签:XML tp5 eth http main you ted col span
原文地址:https://www.cnblogs.com/dayin1/p/13172545.html