Correcting teacher:PHPz
Correction status:qualified
Teacher's comments:
//高级查询
//快捷查询
$res = Db::name('order')
// ->where('order_id|order_sn','=',201804171129599877)
->where('order_amount&total_amount','<',200)
->select();
//批量字段查询
$res = Db::name('order')
->where([
['uid','=',1],
['order_id','>',10]
])
->select();
//whereColumn比较两个字段
$res = Db::name('order')
->whereColumn('confirm_time','>','add_time')
->select();
//动态查询
$res = Db::name('order')
->whereConsignee('上海滩')
->find();
$res = Db::name('order')
->getByConsignee('上海滩');
$res = Db::name('order')
->getFieldByConsignee('上海滩','order_sn');
var_dump($res);
public function demo()
{
//post请求方式
if(!Request::isPost()){
return '请求的类型不是post';
}
$post = Request::post('id/d');
$name = Request::post('name/s');
echo $post;
echo '------------';
echo $name;
echo '------------';
//get 请求方式
// $get =Request::get('name');
// return $get;
//获取header
$info = Request::header();
echo $info['accept'];
echo '------------';
echo $info['accept-encoding'];
echo '------------';
echo $info['user-agent'];
}