public function login() { $data = [ 'username' => 'john', 'email' => 'john@example.com' ]; return redirect()->to('dashboard')->with($data); } 在上面的示例中,控制器方法login()重定向到dashboard方法,并将$data数组传递给重定向。
试试看
phpif($this->session->flashdata('error')):?>×Alert!<?php echo $this->session->flashdata('error')?><?php endif;?><?php echovalidation_errors('');?><?php echoform_open('admin/settings/index/'.$item->id);?><!--Website Favicon--><?php echoform_label('Website Favicon','title...
假设您已登录用户的最后一次登录时间$userData['timestamp'],然后就在redirect('dashboard');您可以添加...
->session->(,);(); Then, in your "welcome" controller or view, you can retrieve and display the flash data message like this: echo$this->session->flashdata('message'); Tags phpredirectcodeigniterurlhelper Submit Do you find this helpful?
redirect_with_input($uri[,...$params]) 参数: $uri (string) – 重定向URI。 $params (mixed) – 一个或更多附加参数可被用于 the RouteCollection::reverseRoute() 方法。 $uri(string) – 重定向URI。 $params(mixed) – 一个或更多附加参数可被用于 theRouteCollection::reverseRoute()方法。
如果你想要创建一个重定向,请使用 redirect() 函数。它将返回一个 RedirectResponse 实例。重要 如果你想要重定向,必须在 Controller 或Controller Filter 的方法中返回 RedirectResponse 实例。请注意, __construct() 或initController() 方法不能返回任何值。如果你忘记返回 RedirectResponse,将不会发生重定向。
fix: Validation returns incorrect errors after Redirect with Input by @kenjis in #5844 feat: [Parser] add configs to change conditional delimiters by @kenjis in #5842 fix: Commands::discoverCommands() loads incorrect classname by @kenjis in #5849 ...
$returnPath (string)– Optional email address to redirect undelivered email to Returns: CodeIgniter\Email\Email instance (method chaining) Return type: CodeIgniter\Email\Email Sets the email address and name of the person sending the email: <?php $email->setFrom('you@example.com', 'Your Na...
Cookies and Headers you set before calling redirect() are not automatically carried over to a RedirectResponse. You need to call withCookies() or withHeaders() manually if you want to send them.You need to change CI3’s redirect('login/form') to ...