本文整理匯總了PHP中cookie::queue方法的典型用法代碼示例。如果您正苦於以下問題:PHP cookie::queue方法的具體用法?PHP cookie::queue怎麽用?PHP cookie::queue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cookie
的用法示例。
在下文中一共展示了cookie::queue方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: logout
public function logout()
{
cookie::queue('uid', null, -1);
cookie::queue('name', null, -1);
cookie::queue('phone', null, -1);
return redirect('/');
}
示例2: signDo
/**
* 進行報名
*/
public function signDo()
{
$rules = array('active_type' => 'required');
$postData = Input::all();
$validator = Validator::make($postData, $rules);
if ($validator->fails()) {
return Redirect::to('sign/' . Input::get('activeId'))->withErrors($validator);
}
$uid = cookie::get('uid');
if ($uid) {
//報名
foreach ($postData['active_type'] as $type) {
DB::table('active_user')->insert(['uid' => $uid, 'active_id' => Input::get('activeId'), 'active_type' => $type]);
}
} else {
//注冊+報名
$phone = Input::get('phone');
$name = Input::get('name');
$rules = array('phone' => 'required', 'name' => 'required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to('sign/' . Input::get('activeId'))->withErrors($validator);
}
$pass = '111111';
//user表寫入數據,注冊
DB::table('user')->insert(['name' => $name, 'phone' => $phone, 'password' => md5($pass)]);
//設置登陸
$lastUid = DB::getPdo()->lastInsertId();
cookie::queue('uid', $lastUid, 86400);
cookie::queue('name', $name, 86400);
cookie::queue('phone', $phone, 86400);
//報名
foreach ($postData['active_type'] as $type) {
DB::table('active_user')->insert(['uid' => $lastUid, 'active_id' => Input::get('activeId'), 'active_type' => $type]);
}
}
return redirect('/');
}