zoukankan      html  css  js  c++  java
  • A函数跨区域

    ODerController.class.php内容如下 

    1
    <?php 2 3 /* 4 * To change this license header, choose License Headers in Project Properties. 5 * To change this template file, choose Tools | Templates 6 * and open the template in the editor. 7 */ 8 9 namespace HomeController; 10 use ThinkController; 11 class ODerController extends Controller{ 12 //未付款的信息 13 public function gwc(){ 14 echo dddd; 15 } 16 }
     UserController.class.php内容如下:
    1
    <?php 2 3 /* 4 * To change this license header, choose License Headers in Project Properties. 5 * To change this template file, choose Tools | Templates 6 * and open the template in the editor. 7 */ 8 9 10 11 namespace HomeController; 12 use ThinkController; 13 class UserController extends Controller{ 14 15 public function info(){ 16 // echo '5555'; 17 /* 18 * 跨控制器调用,现在是自己在调用 19 20 $order = new HomeControllerODerController(); 21 $order->gwc(); 22 */ 23 24 /*跨控制器调用,使用A()函数 25 $order=A('Home/ODer'); 26 *dump();tp系统函数,开发小组自己用的,带有格式的输出 27 *dump($order); 28 * $order->gwc(); 29 */ 30 } 31 }

    备注:

    A函数
        作用:实例化控制器的一个快捷函数

        格式:A(模板/控制器,[控制器层名称]);

      跨控制器调用

        本次练习是在ThinkPHP_3.2_140202下操作的

  • 相关阅读:
    【转】Google 的眼光
    【转】不要去SeaWorld
    【转】Tesla Autopilot
    【转】Tesla Model X的车门设计问题
    【转】Tesla Model S的设计失误
    【转】编程的智慧
    【转】智商的圈套
    【转】创造者的思维方式
    【转】恶评《星际穿越》
    【转】谈创新
  • 原文地址:https://www.cnblogs.com/StinkyKids/p/6439793.html
Copyright © 2011-2022 走看看