ThinkPHP study notes (3) questions about URL path in the project and how to build a page using frame

Source: Internet
Author: User
Tags constant definition
ThinkPHP study notes (3) there are many custom constant paths in thinkphp for URL path problems in the project and building pages using frame, as shown below: // echo & quot; & lt; divstyle = 'font-weight: n ThinkPHP study notes (3) about URL path in the project and


There are many custom constant paths in thinkphp, as shown below:

// Echo "^_^ Hello, welcome to ThinkPHP"; // System constant definition // go to the THinkPHP manual for search // echo"
"." ROOT directory address of the website ". _ ROOT _." "; // echo"
"." Entry file address ". _ APP _." "; // echo"
"." Current module address ". _ URL _." "; // echo"
"." Current url address ". _ SELF _." "; // echo"
"." Current operation Address ". _ ACTION _." "; // echo"
"." Template directory of the CURRENT module ". _ CURRENT _." "; // echo"
"." Current operation name ". ACTION_NAME." "; // echo"
"." Current project directory ". APP_PATH." "; // echo"
"." Current project name ". APP_NAME." "; // echo"
"." Template directory of the current project ". APP_TMPL_PATH." "; // echo"
"." Public File Directory of the project ". APP_PUBLIC_PATH." "; // echo"
"." Configuration file directory of the project ". CONFIG_PATH." "; // echo"
"." Public File Directory of the project ". COMMON_PATH." "; // automatically cache all table-related information. // echo"
"." Project data file directory ". DATA_PATH." data directory under runtime "; // echo"
"." ". GROUP_NAME." "; // echo"
"." ". IS_CGI." "; // echo"
"." ". IS_WIN." "; // echo"
"." ". LANG_SET." "; // echo"
"." ". LOG_PATH." "; // echo"
"." ". LANG_PATH." "; // echo"
"." ". TMPL_PATH." "; // the location where js is put for public resources of multiple applications. // echo"
"." ". WEB_PUBLIC_PATH ."";

Logon page

 Insert title hereTemplate path _ URL __: URL address of the current module
../Public the public directory of the current template
_ PUBLIC _ the same level as the main directory public directory for multiple project applications
_ TMPL _ project template directory
_ APP _ project Url
_ ACTION _ URL of the current operation
_ SELF _ link to the current entire path

Get page:

 Insert title here
 
 
 


The obtained action:

 Verify ();} public function fuck () {header ("Content-Type: text/html; charset = utf-8"); echo "UserAction. the world! "; $ This-> verify ();} private function verify () {$ this-> display (); echo"
UserAction. verification method ";} public function login () {$ this-> assign (" content "," this is the content "); $ this-> display (); echo"
UserAction. verification Method ";}public function add () {dump ($ _ POST); echo $ _ POST ['username']; $ this-> assign (" username ", $ _ POST ['username']); $ this-> display () ;}}?>


Use frame to build a page: Do not introduce static html files. enter the following in the Action method:

IndexAction

 "." ROOT directory address of the website ". _ ROOT _." "; // echo"
"." Entry file address ". _ APP _." "; // echo"
"." Current module address ". _ URL _." "; // echo"
"." Current url address ". _ SELF _." "; // echo"
"." Current operation Address ". _ ACTION _." "; // echo"
"." Template directory of the CURRENT module ". _ CURRENT _." "; // echo"
"." Current operation name ". ACTION_NAME." "; // echo"
"." Current project directory ". APP_PATH." "; // echo"
"." Current project name ". APP_NAME." "; // echo"
"." Template directory of the current project ". APP_TMPL_PATH." "; // echo"
"." Public File Directory of the project ". APP_PUBLIC_PATH." "; // echo"
"." Configuration file directory of the project ". CONFIG_PATH." "; // echo"
"." Public File Directory of the project ". COMMON_PATH." "; // automatically cache all table-related information. // echo"
"." Project data file directory ". DATA_PATH." data directory under runtime "; // echo"
"." ". GROUP_NAME." "; // echo"
"." ". IS_CGI." "; // echo"
"." ". IS_WIN." "; // echo"
"." ". LANG_SET." "; // echo"
"." ". LOG_PATH." "; // echo"
"." ". LANG_PATH." "; // echo"
"." ". TMPL_PATH." "; // the location where js is put for public resources of multiple applications. // echo"
". "". WEB_PUBLIC_PATH. ""; $ this-> display ();} public function top () {$ this-> display ();} public function left () {$ this-> assign ("content", "this is content"); $ this-> display ();} public function right () {$ this-> display ();} // access mode: path_Info // http://localhost/MyThinkPHP/admin.php?m=index&a=hello // http://localhost/MyThinkPHP/admin.php/index/hellopublic Function hello () {header ("Content-Type: text/html; charset = utf-8"); echo "this is my own method! ";}/*** Note the case-sensitivity of the template */public function template () {// you must create a folder Index with the same name as the current controller under the default Tpl of the corresponding project. // then, the html file name is the method name // default delimiter {$ content} // you can modify the delimiters in the template compass. $ this-> assign ("content ", "The Monk went down the hill to improve the speed, and the old monk gave an explanation"); $ this-> display (); // 1. specify a new template under the same level // $ this-> display ("newTemplate"); // 2. cross-controller reference template (you can also add group information) // $ this-> display ("Group: User: verify"); // 3. cross-skin reference // $ this-> display ("test @ User: verify"); // 4. full path output (create a public folder in the directory at the same level of the project) // The location where the file is loaded is all Locate with the main entry file // $ this-> display (". /public/ss.html "); // display parameter // $ this-> display (" location "," UTF-8 "," text/xml ") ;}}?>

Index.html

 

Left.html

 I am a template, I am a template
{$ Content}
I am a template, I am a template

Right.html top.html

 I am a template, I am a template



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.