Workaround: $str = "QB". Str_pad (($maxid [0]["Max (ID)"]+1), 5, "0″,str_pad_left);
where $maxid[0]["max (ID)"]+1) is a value that uses the Max function to find the largest ID from the database, with the ID as the primary key and not duplicated.
Recently want to self-study PHP, made a verification code, but do not know how to do, there is always a small red fork, but the verification code is not shown, for the following reasons
The following error occurred before it was modified;
(1)
In general, PHP in the browser to brush to appear cookies, how to make the cookie in time to take effect, the following to share a cookie in time to take effect of a method, very practical,
The code is as follows:
Copy Code code as follows:
One, download the corresponding DLL
Second, put the file in the PHP installation directory in the Ext folder
Iii. Modification of PHP.ini
Copy Code code as follows:
[Xdebug]
Zend_extension= "./ext/php_xdebug-2.2.3-5.3-vc9-nts.dll"
Read many versions of the PHP asynchronous request method, here a simple summary of several common methods to share
1. Implement one step request with Curl
Curl extension is one of the most common methods we use in the development process, and
Copy Code code as follows:
function Grabimage ($url, $filename = ' ") {
if ($url = = ") {
return false; Returns False if the $url is empty;
}
$ext _name = STRRCHR ($url, '. '); Get the name of the picture extension
if ($ext _name!= '. gif '
Submitting data to b.php in a.php, but b.php is unable to receive data, and CURL operation shows success, very strange. Originally, "Passing an array to Curlopt_postfields,curl will encode the data into multipart/form-data, while passing a
The number of plastic implants in PHP is symbolic, can not represent unsigned integers, when the number of plastic is out of range, automatically converted from the number of php_int_size to float, you can use a constant to see the php integer type
Because of the job needs, I have written a function based on the sample function given in the manual, the code is as follows:
Copy Code code as follows:
Converts all numeric values in a multidimensional array to a string ———— supports a
PHP drawing first to confirm that the GD library is enabled, to the php.ini file, find the Extension=php_gd2.dll will be before, remove, restart the server.
If you do not see a normal picture in the drawing, the server is replying to the request,
No more nonsense, just go to the code.
Copy Code code as follows:
Error_reporting (E_all); Open error
Set_time_limit (0); Script does not timeout
Date_default_timezone_set (' Europe/london '); Set time
/** Include Path **/
The Call_user_func function is used when you need to invoke a function dynamically, and this function has two uses:The first is to invoke the lonely function:
Copy Code code as follows:
function Funa ($b, $c)
{
Echo $b;
Echo $c;
PHP has very rich built-in functions, many we have used, but there are still a lot of functions we are not familiar with, but they are very useful. In this article, I've listed some little-known PHP functions that will brighten your eyes.
In PHP, if you use a session to determine whether a user is logged in or out, you can do so:
Session_Start ();Session_destroy ();
The session indicates that it has ended. Next sentence should write JS, so that the page jump.
If it is a frames
There is no difference in itself, habit problems, but sometimes problems involving operator precedence, the results will be different, recorded.For example:
Copy Code code as follows:
$p = 6 or 0;
Var_dump ($p);//int (6)
$p = 6 | | 0;
The simplest way is to use fopen (), to see if the file can be opened, can play on the file of course there is
Copy Code code as follows:
$url = ' http://www.jb51.net/images/test.jpg ';
if (@fopen ($url, ' R ')){Echo ' File
PHP in the Ini_set function is used to modify the set of PHP php.ini configuration file function, with this function is very convenient, do not have to manually modify the php.ini file, sometimes we do not have the right to modify the php.ini file,
This two days to write a demo, need to use the prompt and jump, the main page requirements are not high, feel that there is no need to use AJAX,JS, and so on, so I studied how in the PHP prompts and jump.
The first is to use the following:
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