<?php namespace app\index\controller; use think\console\Input; use think\Controller; use think\Db; use think\Request; class Index2 extends Controller { public function index($name="张三") { // return '<style type="text/css">*{ p
1.请求对象 //传统调用$request = Request::instance();//实例化对象 $request->url();//获取当前的域名 //继承think\Controller class Index extends Controller(){ public function hello(){ return $this->request->url();//获取当前域名 } } //自动注入请求对象 class Index(){ public function hell
场景:我的本地网页服务器无法访问本地的接口服务器接口提示一下错误:大致意思是:是一个跨域请求我的没有访问该地址的权限(接口服务器采用的是PHP编写) XMLHttpRequest cannot load http://localhost/mz/goods/getList. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is prese