1, if you want to output the variable in the template, you must pass the variable to the template in the controller, the system provides the Assign method to assign a value to the template variable, regardless of what type of variable is uniformly used assign assignment, and the Assign method must be called before the display and the Show method.
$array ['name'] ='thinkphp'; $array ['Email'] ='[email protected]'; $array ['Phone'] ='12335678';$ This-assign ($array); $ This->display ();
You can then output the name, email, and phone three variables in the template file:
<?php Echo $name. ' ['. $email. ". $phone. ' ]';? >
2. render output does not need to write the path and suffix of the template file, to be precise, the controller and operation does not necessarily need to have the actual corresponding controller and operation, just a directory name and file name, for example, your project may not have a public controller at all, There is no menu operation for the public controller, but it can be used as well:
$This->display ('public:menu');
3. Continuous ...
thinkphp Development Notes-View