一、sublime 另存为 ALT+F 再按Aphp
二、空值 |default=''html
三、两个时间戳 手册位置:模型——自动时间戳html5
create_time 添加时间
update_time修改时间
四、from表单提交 提交地址,注意是get仍是post,这个很重要!!!Route::post('admin/login/check','admin/login/check'); 数据库
<form class="well" action="{:url('admin/login/check')}" method="post">
总结先后台交互,首先得有提交按钮或者表单,如上面,其次创建一个路由,最后,在控制器里面写出方法。session
五、html5里 隐藏属性 type="hidden"post
六、password_hash('admin',PASSWORD_DEFAULT) ; 加密 变量1为要加密的数据,后面的是常量,固定值this
password_verify() 解密加密
七、跳转url
redirect里面是路由地址
return $this->redirect("admin/index/index");
八、Session 手册位置:杂项——sessionspa
使用方法:
//写session use think\facade\Session; Session::set('name',$user->id);//$user->id指的是获取数据库里面的值。name自定义的 //读取session use think\facade\Session; var_dump(Session::get('name'));
//验证session
$id = Session::get('name');
if (!$id) {
return $this->error('请先登陆',url('admin/login/index'));
}
九、传递php里面的数据到view
//php代码 $this->assign('userssss',$user); //html代码 {$userssss->name|default=''}