Thinkphp's webpage special effect code in the controller cannot execute a solution. take "exit" for example. my "exit system" link is written to the framework on the left, dynamically generated using js. That is to say, the target in the link cannot be specified.
Thinkphp's webpage special effect code in the controller cannot execute a solution. take "exit" for example. my "exit system" link is written to the framework on the left, dynamically generated using js. That is to say, the target in the link cannot be specified.
- View sourceprint? 1 $ this-> assign ('jumpurl' ,__ url _. '/login ');
$ This-> success ("logout successful! ");
In this way, the page to jump to will be displayed in the right frame, and the js code cannot be written into the url. I have commented out the two lines of code. Direct use:
- View sourceprint? 1 echo "script window. top. location. href = '$ url'; script";
This is not the case. On the one hand, the _ app _ constants cannot be used in the url. on the other hand, the final execution result is to remove the script tag and directly output the rest!
(Window. top. location. href = 'index/login';). I checked the success function in the action class and found no relevant parameters.
When I was eating at a friend's house on Sunday, I suddenly thought of a problem. The tags in tp are included in angle brackets (<>, is the script I wrote in the controller parsed as a tag? So I re-wrote the second code:
- View sourceprint? 1 echo' Script alert ("exited successfully"); top. location. href = "login"; script ';
That's all.