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

WBOY
Release: 2016-07-13 09:49:41
Original
844 people have browsed it

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>

Copy after login

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...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template