In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "how to write ThinkPHP data pagination". In daily operation, I believe many people have doubts about how to write ThinkPHP data paging. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to write ThinkPHP data paging". Next, please follow the editor to study!
1. First, we have to create a database test.sql code for paging testing as follows.
CREATE TABLE `test` (`id` int (10) unsigned NOT NULL auto_increment, `name` char (100) NOT NULL, `content` varchar (300) NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=27 INSERT INTO `test` (`id`, `name`, `content`) VALUES (19, '123,' 123), (20, '1231,' 123123), (21, '123123,' 123123123'), (26,'24, '123123), (25,' 321123, '321123'), (24, 'age',' age'), (23, '123123,' 123123'), (22, '213),' 123123')
two。 Next, we have to create a new ThinkPHP project. The new version of tp has built-in the ability to automatically generate the project directory.
Create a new test folder under htdocs (that is, your website root), place the THINKPHP core folder in the test root directory, and create a new file index.php in the test root directory. Add the following code:
/ / define the ThinkPHP framework path define ('THINK_PATH','. / Thinkphp'); / / define the project name and path. These two sentences are the main points. Define ('APP_NAME',' test'); define ('APP_PATH','. / test'); / load framework entry file require (THINK_PATH. "/ ThinkPHP.php"); / / instantiate a website application instance $App = new App (); / / Application initialization $App- > run ()
Run "http://localhost/test/index.php"." You will see the welcome page of ThinkPHP. Then open your test directory and find that there is an extra test folder in the root directory. At this time, your project directory has been generated.
Open the / test/test/conf/ directory, create a new "config.php" and configure your database connection.
If you want to turn on debug mode, add it to the array
"debug_mode" = > true
3. The realization of basic page input and output.
(1) Open / test/test/lib/action/IndexAction.class.php and you will find the following code
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.