June 13 Controller

Source: Internet
Author: User

Self-write Controller:

MainController.class.php:

<?phpnamespace Home\controller; UseThink\controller;classMaincontrollerextendscontroller{//front-mounted Operation     Public function_before_xianshi () {Echo"Before display"; }         Public functionXianshi () {
echo $_post["name"]; Echo"Main Page";
Pass parameters
echo $name. $age; //Read Configuration /*$model = C (' Url_model '); Echo $model; */ //Dynamic Configuration /*C (' Url_model ', 0); Echo U ("Xianshi");*/ } //Post-Operation Public function_after_xianshi () {Echo"After display"; } Public functionCeshi () {
Registering variables
$this->assign ("text", "Hello");
Call Template display//$this-Display ();
Var_dump (Get_defined_constants (True));//Constant Information}
Public Function Login ()
{
Implement two logic, display, login
if (empty ($_post))
{
$this->display ();
}
Else
{
Implement Login
echo "Implement login";
}

}}

Enter HTTP://LOCALHOST:8080/THIMK/INDEX.PHP/HOME/MAIN/XIANSHI/NAME/LI/AGE/22 in the browser to run the display

To run Ceshi (), also create a folder in view Main, create a ceshi.html document in the new folder

Ceshi.html:

<Head><MetaCharSet= "Utf-8" /><title>Untitled Document</title></Head><Body><ahref= "/THIMK/INDEX.PHP/HOME/MAIN/XIANSHI/NAME/LI/AGE/22">Invoke display operation</a>

<div><{$text}></div>
<form action= "__controller__/xianshi "method=" POST ">
<input type= "text" name= "name"/>
<input type= "Submit" value= "Submission"/>
</form>
</Body>

Enter Http://localhost:8080/thimk/index.php/Home/Main/CeShi in the browser to run the display

Login.html:

<Head><MetaCharSet= "Utf-8" /></Head><Body><formAction= "__action__"Method= "POST"><inputtype= "text"name= "UID" /><inputtype= "Password"name= "pwd" /><inputtype= "Submit"value= "Submit" /></form></Body>

June 13 Controller

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.