Home >Backend Development >PHP Tutorial >Using U method to call js file instance in ThinkPHP, _PHP tutorial

Using U method to call js file instance in ThinkPHP, _PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 09:49:41884browse

Instances of using U method to call js files in ThinkPHP,

This article describes the method of using U method to call js files 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:
Copy code 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:

<&#63;php
class JsAction extends Action{
  function nav() {
    $this->display('Index:js:nav');
  }
}
&#63;>
//最后,把左框架里的JS链接改一下:
<script type="text/javascript" src="{:U('Js/nav')}"></script>

I hope this article will be helpful to everyone’s PHP programming based on the ThinkPHP framework.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1019072.htmlTechArticleAn example of using the U method to call a js file in ThinkPHP. This example describes how to use the U method to call a js file in ThinkPHP. . Share it with everyone for your reference. The details are as follows: Provided in TP...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn