Example of using U method to call js file in ThinkPHP
This article describes the example of using U method to call js file in ThinkPHP. Share it with everyone for your reference. The details are as follows:
TP provides a shortcut method to directly call functions in template files. U is one of them. Its usage is in the manual:
The code is as follows:
{:U('User/insert' )}
First change the suffix of the js file to html (this will not affect it), then write a JsAction and call it in it:
?
1
2
3
4
5
6
7
8
9
|
class JsAction extends Action{
function nav() {
$this->display('Index:js:nav');
}
}
?>
//最后,把左框架里的JS链接改一下:
|
1
2
3
4
5
6
7
8
9
|
class JsAction extends Action{function nav() {<🎜>
<🎜>$this->display('Index:js:nav');
}
}
?>
//Finally, change the JS link in the left frame:
|
I hope this article will be helpful to everyone’s PHP programming based on the ThinkPHP framework.
http://www.bkjia.com/PHPjc/1018366.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1018366.htmlTechArticleAn example of using the U method to call js files in ThinkPHP. This example describes the method of using the U method to call js files in ThinkPHP. Share it with everyone for your reference. The details are as follows: TP provides in-module...