The field method of the ThinkPHP CURD method is one of the coherent operation methods of the model. The main purpose isIdentifies the fields to be returned or operatedAnd can be used for query and write operations.
1. Used for query
The field method
1. How to obtain the module name and controller name through the address bar parameters (even if there is a route and a rewrite module is enabled)
2. How does tp implement the pre-and post-method functional modules and how does it execute methods
Randimage. php
Copy codeThe Code is as follows:/*+ ----------------------------------------------------------- +| By Bleakwind http://www.weaverdream.com+ ----------------------------------------------------------- +*/$ Dir = "images/"; // image
Copy codeThe Code is as follows:/**** Separate Arrays by the specified number.* @ Param array $ array the array to be split* @ Param int $ number of groupNum groups*/Public function splitArray ($ array, $ groupNum ){If (empty ($ array) return array (
Some browsers have installed pdf open programs associated with browsers, so when writing the pdf path directly, they open the pdf instead of downloading. Next, let's say that if they just download, not browse.Create a PHP FileCopy codeThe Code is as
PhpQuery is an open-source PHP-based server project that allows PHP developers to easily process DOM document content, such as getting headlines from a news website. What's more, it uses the idea of jQuery. You can process the page content like
The following PHP code instance helps you reset the password. requestResetPassword is used to receive and check the password reset request. For better reusability, I will separately allocate the password reset operation to a new resetPassword
When we write a program, it is inevitable that there will be problems (which often occur). When PHP encounters an error, it will give the location, number of lines, and the cause of the error script. Many people say that this is no big deal. Indeed,
For more information about how to implement event listening, see jQuery's event binding logic.Main functions:1. Event binding supports binding one event to multiple actions and one-time event binding.2. trigger events3. deregister the eventCopy
Environment: CentOS-5.4Php upgrade: 5.4.14-5.5.0Upgrade experience: relatively smooth, but one thing to note: eaccelerator is not compatible with php5.5.0. Fortunately, php provides Zend OPcache by default in 5.5.0, so friends who have been used to
The header () function sends the original HTTP header to the client.Copy codeThe Code is as follows:// 200 normal statusHeader ('HTTP/1.1 200 OK ');// 301 permanent redirection. Remember to add the targeted address Location: $ url later.Header
Copy codeThe Code is as follows:Function chineseFirst ($ str){$ Str = iconv ("UTF-8", "gb2312", $ str); // if the program is gbk, comment out this line// Judge whether all strings are ChineseIf (preg_match ("/^ [\ x7f-\ xff]/", $ str )){$ Fchar =
Sometimes, when we run the php program again
Allowed memory size of 8388608 bytes exhausted (tried to allocate 1298358 bytes)
Cause of the error: make sure it is not the cause of the program (such as an endless loop ), because the maximum memory
We first assume that the encoding used in the database is UTF-8In this case, we should first addCopy codeThe Code is as follows:Here, the charset value UTF-8 must be the same as the encoding type when the file is saved.
And then add it before
16th. Shipbuilding and defense (FleetBuildingPage. php and DefensesBuildingPage. php pages)
Let's talk about the shipyard page first. In fact, there is no real shipbuilding on this page, but it just saves the ship and quantity to the database. The
The in label and range label of the ThinkPHP template are usedDetermines whether a template variable is within a certain range..1. in tagThe in tag of ThinkPHP is used to determine whether a template variable is within a certain range. The format is
ThinkPHP supports multiple php template engines and can be configured as needed.The following uses the Smarty template engine as an example to describe the specific operation process!
First download a Smarty from the Smarty official website. Site:
In php, there are many functions that can be used to traverse arrays, such as the for statement, list, each, and foreach functions. These are also the main functions used to traverse arrays in php, next I will introduce it to you.
Foreach traversal
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