Thinkphp message board How to write?

Source: Internet
Author: User
RT, the boss let write a message board, but I thinkphp framework has not learned, can not write Ah. Ask you to give some ideas, in the end how to write?


Reply to discussion (solution)

Message board can also be written without thinkphp.

This you say the idea is what ah, just an increase message, the function of storage,

Message board can also be written without thinkphp.


Don't thinkphp I can write, problem boss let Phpthink write Ah, how to do!

This you say the idea is what ah, just an increase message, the function of storage,


As long as the simplest function on the line, add messages and display messages, other features temporarily do not.


This you say the idea is what ah, just an increase message, the function of storage,


As long as the simplest function on the line, add messages and display messages, other features temporarily do not.

Then you have PHP base, see how TP run it, and then look at the curd operation, basically it can.



This you say the idea is what ah, just an increase message, the function of storage,


As long as the simplest function on the line, add messages and display messages, other features temporarily do not.

Then you have PHP base, see how TP run it, and then look at the curd operation, basically it can.


How to understand the operation principle of TP the fastest ah? See the TP development manual? But I'm in a hurry, can you tell me the main parts of the manual can be basically developed? Thanks, man.

First of all, knowing that thinkphp is an MVC framework is OK.
Model---How to operate the database
The Action---have function,m=actionname&a=methodname in it to access a method.
TPL---Templates
such as message board:
Need to show, need to read, need to insert
It is good to write a function for each action, and the method of calling the model class in function is good.

First of all, knowing that thinkphp is an MVC framework is OK.
Model---How to operate the database
The Action---have function,m=actionname&a=methodname in it to access a method.
TPL---Templates
such as message board:
Need to show, need to read, need to insert
It is good to write a function for each action, and the method of calling the model class in function is good.


I have now built a Liuyan database, there is a details table used to put the message data, to show out, what to do?

Super simple
This is the method in action

function Detail_show () {    $msgs = M (' details ')->select ();    $this->assign (' Details ', $msgs);    $this->display ();}

In the template

User name: {$detail. Username}: {$detail. Content}---Time: {$detail. add_time|date= "Y-m-d h:i:s", # # #}


So it's going to be a line of loops.

Super simple
This is the method in action

function Detail_show () {    $msgs = M (' details ')->select ();    $this->assign (' Details ', $msgs);    $this->display ();}

In the template

User name: {$detail. Username}: {$detail. Content}---Time: {$detail. add_time|date= "Y-m-d h:i:s", # # #}


So it's going to be a line of loops.


Well, I'm going to add a message. How do I write the method and action properties of the form?

Super simple
This is the method in action

function Detail_show () {    $msgs = M (' details ')->select ();    $this->assign (' Details ', $msgs);    $this->display ();}

In the template

User name: {$detail. Username}: {$detail. Content}---Time: {$detail. add_time|date= "Y-m-d h:i:s", # # #}


So it's going to be a line of loops.


Ask for advice ah ....

Ask for help Ah, increase the message this function how to get!

form is the normal form is OK, form of action= '/?m=liuyanban&a=add_liuyan '
This is handled in action
$data [' user_id '] = $this->_get (' user_id ');
$data [' content '] = $this->_get (' content ');
M (' Liuyan ')->add ($data);
This will insert the database.

form is the normal form is OK, form of action= '/?m=liuyanban&a=add_liuyan '
This is handled in action
$data [' user_id '] = $this->_get (' user_id ');
$data [' content '] = $this->_get (' content ');
M (' Liuyan ')->add ($data);
This will insert the database.


Own blind to engage in, success, action and you have a little difference, other similar, or thank you.
Tomorrow, the boss will have to come to new tasks, thinkphp still have to learn ah, do not understand the words I ask again.
  • Related Article

    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.