In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
How to carry out TP5 redirection, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
Learning goal
First, page jump
If you want to use page jumps, you must inherit the base class Controller class, because the base class Controller introduces the trait class library, which in turn implements the jump methods of success () and error ().
1. Current controller
To demonstrate in the default controller of the default module, first inherit from the base class Controller, create a hello () method in the current Index controller to simulate the background login of the website and the jump of the page:
Class Index extends\ think\ Controller {public function index () {return 'TP5 Learning ing....';} public function hello ($name) {if ($name=='thinkphp') {$this- > success (' verification successful, jumping ~', 'ok');} else {$this- > error (' verification failed, return to landing page', 'login') }} public function ok () {return 'Welcome to this system';} public function login () {return 'Landing Page';}}
Logically, if the url accessed is: http://tp5.com/index/index/hello/name/thinkphp, it executes the success () method and jumps to the ok () method. Otherwise, using: http://tp5.com/index/index/hello/name/tp5, it takes the error () method and jumps to the login () method.
2. Cross the controller
First create a new controller Login and cut the ok () and login () methods in Index into the file:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.