Thinkphp Message Board Skeleton

Source: Internet
Author: User

Show page code

<formAction= "/lyb/index.php/index/insert.html"Method= "POST"><inputname= "text"type= "text"value= "form Submission" /><inputname= "AAA"type= "Submit" /></form>

The action address should be replaced with the U method in thinkphp, that is, to find a method in the controller, this method is responsible for receiving post data, and add data to the database

Controller code

<?PHP//This class is automatically generated by the system and is intended for testing purposes onlyclassIndexactionextendsAction { Public functionindex () {$this-display (); } Public functionInsert () {Header("content-type:text/html; Charset=utf-8 ");$Text=$_post[' Text ']; $Dao= M ("Ly");//instantiating a model class    $list=$Dao-Select (); //building an array of data to write    $data["content"] =$Text;if($lastInsId=$Dao->add ($data)){        EchoThe Insert Data ID is:$lastInsId"; } Else {        $this->error (' Data write Error! ‘); } Dump ($Text);$this->assign (' div ',$list); $this->display (' Index '); }} 

Page display Code

<formAction= "{: U (' Index/insert ')}"Method= "POST"><inputname= "text"type= "text"value= "form Submission" /><inputname= "AAA"type= "Submit" /></form><foreachname= "Div"Item= "Vo"><Divstyle= "Background-color: #FF8F59; onclick="window.open ">{$vo. Content}</Div>      </foreach>

Finally, the database design and the database Setup code

Database Setup Code

<?PHPreturn Array(    //' Config item ' = ' config value '//' USERNAME ' + ' admin ',//assignment//database configuration information' Db_type ' = ' mysql ',//Database Type' db_host ' = ' localhost ',//Server Address' Db_name ' = ' lyb ',//Database name' Db_user ' = ' root ',//User name' Db_pwd ' = ' root ',//Password' Db_port ' = 3306,//Port' Db_prefix ' = ' xp_ ',//database table prefix//other project configuration Parameters//...);?>

Http://url.cn/dmfB8I

Thinkphp Message Board Skeleton

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.