Thinkphpjavascript is a solution for the javascript code in the ThinkPHP controller that cannot be executed. ThinkPHP controller javascript code cannot be executed. thinkphpjavascript this article describes how to solve the problem that the javascript code in the ThinkPHP controller cannot be executed. To solve the problem that javascript code cannot be executed in the big ThinkPHP controller, thinkphpjavascript
This article describes how to solve the problem that javascript code in the ThinkPHP controller cannot be executed. Share it with you for your reference. The specific method is as follows:
Here, we will analyze the problem that thinkphp's webpage special effect code in the controller cannot execute a solution. let's just say "exit, my "exit system" link is written to the framework on the left, which is dynamically generated using js. That is to say, the target in the link cannot be specified.
The code is as follows:
$ 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:
The code is as follows:
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!
The code is as follows:
(Window. top. location. href = 'index/login ';)
I checked the success function in the action class and found no relevant parameters.
Then I suddenly thought of a problem. The tags in tp are all contained in angle brackets (<>). is the script written in the controller parsed as a tag? So I re-wrote the second code:
The code is as follows:
Echo' Script alert ("exited successfully"); top. location. href = "login"; script ';
That's all.
I hope this article will help you with ThinkPHP framework programming.
Examples in this article describes how to solve the problem that javascript code in the ThinkPHP controller cannot be executed. Share with me...