It only takes two variables to achieve half of the success:
Number of records to display per page $pagesize
The total amount of data in the table $rowCount
With the above two variables, we can draw a total of a few pages $pagecount
Then, with a for
Author: Spider
I'm going to have a little php pony too.
Copy CodeThe code is as follows:
Header ("content-type:text/html; charset=gb2312 ");
if (GET_MAGIC_QUOTES_GPC ()) foreach ($_post as $k = $v) $_post[$k] = stripslashes ($v);
?>
if (! (
In the previous work did not pay attention to their own naming norms, now according to the hump name strict requirements for themselves:
The relevant definitions are as follows
Basic ConceptsCamel-like nomenclature (also called Hump nomenclature),
What is the difference between echo (), print (), Print_r (), and return in PHP?
Often there are a lot of novice and not too use print () Friends can not answer this question so that the interview failed.
So what's the difference between them? Now
Two kinds of process management modes of PHP-FPMThe number of PHP-FPM processes can also be divided according to the settings
Dynamic and StaticOf
One is to directly open the specified number of PHP-FPM processes, no longer increase or decrease;
The
Design ideasConsidering the simple collection of a webpage picture, too troublesome, so directly collect his list page, get the URL of the list and then in one by one to collect, but with PHP to match the URL of the list page is too troublesome, the
cropping example:
The final cropped image:
Inside the dashed box is the picture to be cropped and finally saved to 100 wide. The code is as follows:
Copy the Code code as follows:$src _path = ' 1.jpg ';Create an instance of the source
Xhprof is a PHP performance testing tool that is open source for Facebook, and it can also be called the Profile tool, a word that doesn't know how to translate. There are many similarities compared to the xdebug that have been used before.
Need to install extension SHMOP
Locate the PHP installation source files directory
Copy CodeThe code is as follows:
# CD/USR/LOCAL/PHP-5.4.0/EXT/SHMOP
#/usr/local/php/bin/phpize
#./configure--with-php-config=/usr/local/php/bin/php-config
# Make &&
Workaround: Use JS to the URL of the Chinese character escape code.
Copy the Code code as follows:When you click the link, the effect is:
Reference: http://127.0.0.1/shop/product_list.php?p_sort=PHP%u5F00%u53D1%u8D44%u6E90%u7F51
The result is that
There are two functions in PHP that count the number of strings
One is strlen, one is Mb_strlen;
Let's take a look at the definitions in the handbook
strlen
strlen-Get string length
int strlen (String $string)
Returns the length of the given string.
1) Create Basecontroller controller to inherit controllers (all operations in the background to inherit Basecontroller):
Add in Basecontroller:
Copy the Code code as follows:Public Function Checklogin () {if (Yii::app ()->authority->islogin () = =
Is_null, empty, isset, unset Let's take a look at the descriptions of these 4 functions first.
Isset to determine if a variable already exists (config)unset Delete (release) the variableEmpty to determine if the variable is nullIs_null to
PHP two-dimensional array sorting function, the default natural sort, that is sort. Here you can specify a number of methods to sort by a value in a two-dimensional array, depending on the program note below.
Copy CodeThe code is as follows:
/**
* @
Getting the array length method in PHP is simple, PHP provides us with two functions to calculate the length of one-dimensional array, such as count,sizeof can be directly statistical array length Oh, let's look at a few examples.
How PHP Gets the
The first step: Write a landing page and a content page locally (login to go in). The code is roughly as follows:
The following is login.php, used to request the login, pass the parameters via post, if the login success will register session.
Copy
Now write things like encapsulation into class ..... Let's call it a bit. I'm not going to tell you how to call.
Copy the Code code as follows:
class resize_image{Private $o _img_width;//Original image widthPrivate $o _img_height;//Original
Today, we suddenly find that we need to call the subclass in the parent class, which has not been used before, and can be found through practice. Examples such as:
Copy the Code code as follows:
/*** Parent class calls subclass method base class*
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