This article mainly introduces the solution to the problem that the javascript code in the ThinkPHP controller cannot be executed. Using ThinkPHP's
The example in this article describes the solution to the problem that the javascript code in the ThinkPHP controller cannot be executed. Share it with everyone for your reference. The specific method is as follows:
Here is an example analysis of the solution to the problem that thinkphp's web page special effects code in the controller cannot be executed. Let's take the "Exit" item as an example. My "Exit System" link is written The one in the frame on the left is dynamically generated using js. In other words, it cannot be specified through the target in the link.
Copy code The code is as follows:
$this->assign('jumpurl',__url__.'/login');<br>$this->success("注销成功!");
If written like this, the page to be jumped will be displayed in the right frame. Write the js code to It doesn't work in the url, I commented out these two lines of code. Directly use:
Copy code The code is as follows:
echo "<script>window.top.location.href='$url';</script>";
This will not work. On the one hand, the constants __app__ cannot be used in the url, on the other hand , the final result of the execution is that the