1. 自动输出
default_return_type
输出类型
html
view
json
jsonp
xml
redirect
2. 手动输出
~~~
return json($data);
return xml($data);
~~~
3. 页面跳转
~~~
namespace app\index\Controller;
class Index extends Controller{
public function index($name=''){
if('Jim'==$name){
$this->success('jim','hello');
}else{
$this->error('name error','guest');
}
}
public function hello(){return 'hello,Jim!';}
public function guest(){return 'hello,Guest!';}
}
~~~
~~~
$this->redirect('https://51cto.com');
redirect('https://51cto.com');
~~~