How to write thinkphp message board?

Source: Internet
Author: User
How to write thinkphp message board? RT. the boss asked me to write a message board, but I haven't learned the thinkphp framework yet .. Please give me some ideas. what should I do?


Reply to discussion (solution)

Message board can be written without thinkPHP.

What are your ideas? just add a message and store it in the database,

Message board can be written without thinkPHP.


I will write data without thinkphp. the boss asked me to write data with phpthink. what should I do!

What are your ideas? just add a message and store it in the database,


You only need the simplest functions. you can add and display comments. do not use other functions for the moment ..


What are your ideas? just add a message and store it in the database,


You only need the simplest functions. you can add and display comments. do not use other functions for the moment ..

Then you have the PHP Foundation. let's see how TP runs. then you can check the CURD operation.



What are your ideas? just add a message and store it in the database,


You only need the simplest functions. you can add and display comments. do not use other functions for the moment ..

Then you have the PHP Foundation. let's see how TP runs. then you can check the CURD operation.


How can we understand the operating principles of TP as quickly as possible? Check the TP Development Manual? But I am in a hurry. can you tell me which part of the manual can be developed? Thank you.

First, we know thinkphp is an MVC framework.
Model --- specific methods for operating databases
Action --- there is a function in it. m = actionName & a = methodName will access a method.
Tpl --- Template
For example, the message board:
Display required, read required, insert required
Just write a function for each action, and call the method of the Model class in the function.

First, we know thinkphp is an MVC framework.
Model --- specific methods for operating databases
Action --- there is a function in it. m = actionName & a = methodName will access a method.
Tpl --- Template
For example, the message board:
Display required, read required, insert required
Just write a function for each action, and call the method of the Model class in the function.


I have now created a liuyan database, which contains a details Table for storing the message data. what operations should I do if I want to display it ..

Super simple
This is the method in action.

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

In the template

Username: {$ detail. username}: {$ detail. content} --- Time: {$ detail. add_time | date = "Y-m-d H: I: s ",###}


In this way, one row will be cyclically generated.

Super simple
This is the method in action.

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

In the template

Username: {$ detail. username}: {$ detail. content} --- Time: {$ detail. add_time | date = "Y-m-d H: I: s ",###}


In this way, one row will be cyclically generated.


Well, I want to add a message. how do I write the method and action attributes 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

Username: {$ detail. username}: {$ detail. content} --- Time: {$ detail. add_time | date = "Y-m-d H: I: s ",###}


In this way, one row will be cyclically generated.


Please advise ....

Help! how can I get this function!

The form is a normal form. The form action is '/? M = liuyanban & a = add_liuyan'
In action
$ Data ['User _ id'] = $ this-> _ get ('User _ id ');
$ Data ['content'] = $ this-> _ get ('content ');
M ('liuany')-> add ($ data );
This inserts the database.

The form is a normal form. The form action is '/? M = liuyanban & a = add_liuyan'
In action
$ Data ['User _ id'] = $ this-> _ get ('User _ id ');
$ Data ['content'] = $ this-> _ get ('content ');
M ('liuany')-> add ($ data );
This inserts the database.


If you have done this by yourself, it is successful. action is a little different from yours. it's almost the same. thank you.
It is estimated that the boss will have a new job tomorrow, and thinkphp will have to learn it. if you don't understand it, let me ask again.

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.