Imagecreatetruecolor () after creating a true color image,The first color registered by the imagecolorallocate () method is not automatically used as the background color, but must be filled with imagefill ().
// Set the color
$ Bg = imagecolorallocate ($ im, 240,240, 0); // set the background color.Imagefill ($ im, $ bg); // loads the background color$ Te = imagecolorallocate ($ im, 0, 0, 0); // string color// Add the string to the imageImagestring ($ im, rand (3, 6), rand (5, 60), rand (5
() file pointer to read a row and parse the CSV Field
For example, I want to read the following csv file
The Code is as follows:
Copy code
/** By www. bKjia. c0m */$ Row = 1;$ Handle = fopen ("file.csv", "r ");// Fgetcsv () parses the read rows, finds fields in CSV format, and returns an array containing these fields.While ($ data = fgetcsv ($ handle, 1000 ,",")){$ Num = count ($ data );Echo "$ Row ++;For ($ c = 0; $ c // Pay
();};St [0]. onmouseout = function (){St. animate ({fill: fillcolor, stroke: "# eee" },500 );China [state] ['text']. toFront ();R. safari ();};}) (China [state] ['path'], state );I ++;}});});
In the above Code, use var fillcolor = colors [arr [I]; To obtain the color value of the corresponding level, and then use st. attr ({fill: fillcolor}); fill the color in the corresponding province block. In addition, the string2Array () function converts a string to an array.
The Code is
( $ arr) sorts the array key values by 'natural sorted' and letters by length.Natcasesort ( $ arr) performs a case-insensitive 'natural ranking' on the array'
Usort ( $ arr, cmp_function) User-Defined Function sorts an array and resorts the key namesUksort ( $ arr, cmp_function) User-Defined Function sorts an array by key nameUasort ( $ arr, cmp_function) User-Defined Function sorts the array and keeps the index unchanged
Array_multisort ($ arr, mixed)The second parameter indicates that the sor
as $ key => $ value ){If (funstringexist ($ value, $ arrfiltrate )){Echo "alert (/" neeao prompt, invalid character /");";If (empty ($ strgourl )){Echo "history. go (-1 );";} Else {Echo "window. location =/" ". $ strgourl ."/";";}Exit;}}
Let's take a look at the injection details.
Converted to ascii is char (97,108,112,104, 97)The hexadecimal value is 0x616c706861.(We will provide hexadecimal and ascii conversion tools on the CD)All right, enter the following in the browser:
Http: // localh
Php tutorial ini_get error setting method
You can use ini_set to quickly modify php. ini configuration settings, no need to open php. ini is enough, especially when you do not modify php on the VM. the role of this function will be discovered when ini is authorized. Let's look at several instances.*/// Ini_set has the ability to change php. ini settings. This function receives two parameters: the name of the configuration variable to be adjusted and the new value of the variable.
For more detail
Php Tutorial: get the file type of the uploaded file name
$ Imgname = $ _ FILES ["file"] ["name"]; // get the name of the uploaded file$ Filetype = pathinfo ($ imgname, PATHINFO_EXTENSION); // get the suffix$ Newname = date ("Ymdhis"). ".". $ filetype; // create a new name
Check again
$ File = 'www.bKjia.c0m.gif ';Echo getfix ($ file );
// The obtained value is gif. This method is the simplest and the most practical. Let's take a look at method 2. This method reads the extension us
We generally obtain the data submitted by the form. If we use checkbox [] to perform this operation, we will look at the instance below.-->
123
If ($ _ post){Print_r ($ _ post );// The input is also saved as data,/*Array([Checkbox] => array([0] => 1[1] => 2[2] => 3)[Button] => submit)In this way, we only need*/$ Array = $ _ post ['checkbox'];Print_r ($ array );/*The result is as follows:Array([0] => 1[1] => 2[2] => 3)
In fact, 1, 2, and 3 are what we want. We can use SQL in to batch delete t
If php file upload is not implemented using ajax, the effect is not very good, and the user experience is not very good. Let's take a look at this ajax + php new file upload code. Ajax + php Upload code without refreshing new files
Ajax + php tutorial without refreshing file upload code Nbsp;
File. php file
$ Sort = 12;$ F_type = strtolower ("swf, jpg, rar, zip, 7z, iso, gif"); // you can specify the file type that can be uploaded.$ File_size_max = 200*1024*1024; // limit the maximum upload capa
In js, if you want to achieve the simplest copy content, you can click the button to copy the content, we will use window. clipboardData. setData (\ "Text \", \ 'contains www. bKjia. c0m \ '); below I will summarize various replication effect codes.
Code 1: copy the topic address and send it to a friend on QQ/MSN.
The Code is as follows:
Copy code
Copy the code of the text box:
The Code is as follows:
Copy
Traverse and delete Spaces
The Code is as follows:
Copy code
// For the user to callFunction trim (s ){Return trimRight (trimLeft (s ));}// Remove the left blankFunction trimLeft (s ){If (s = null ){Return "";}Var whitespace = new String ("tnr ");Var str = new String (s );If (whitespace. indexOf (str. charAt (0 ))! =-1 ){Var j = 0, I = str. length;While (j J ++;}Str = str. substring (j, I );}Return str;}// Remove the blank www. bKjia.
SQL join left join query instance tutorial
Table a: results and data
StudentID workID store1 1 981 2 952 1 902 3 80
Table B: results and dataWorkID workName1 zuoye2 www. bKjia. c0m3 wenti
The join left join query result is as follows:
StudentID workID workName store1 1 zuoye 981 2 shiti 95OrStudentID workID workName store2 1 zuoye 982 3 wenti 80*/
$ SQL = 'select a. studentid, a. workid, B. workname from a join B on a. workid = B. workid where a. studentid = 1 ';
$ Sql2 = 'select. studentid,. wo
blank link and use javascript:; to replace it.2. Use location. reload () to refresh the page only when appropriate. This method will forcibly clear the cache and increase the page loading time.
How to automatically refresh the page:
1. Automatically refresh the page: Add the following code to the
The Code is as follows:
Copy code
20 indicates refreshing the page every 20 seconds.
2. automatic page Jump: Add the following code to the
The Code is as fol
There are many rounding functions in js, such as toFixed and Math. round () and Math. pow () and other functions. The following articles mainly introduce toFixed and Math. round () and Math. do not miss out on the four functions of pow.
Previously, I was a little JavaScript, and my understanding of jQuery was limited to the use of basic functions. I recently read "JavaScript DOM programming art", and I am learning a little basic knowledge. There is a function in the instance that needs to round
Use the onKeyDown and onKeyUp events of js textarea to monitor user key events in real time, and then use our custom statistical function to calculate the number and number of characters that can be entered.
Real-time statistics html
The Code is as follows:
Copy code
Onfocus = "if (this. value = 'high quality and professional answers are easier to follow! ') This. value = '';" onblur = "if (this. value ='') this. value = 'high quality and professional answers are easier t
Js image carousel code with buffering effect this article provides two js image carousel codes with buffering effects, and a customizable slide and image buffering code, if you need to modify
Js image carousel code with Buffer EffectThis article provides two js image carousel codes with buffering effects, and a customizable slide and image buffering code. If you need to modify them
Add a, and tens of thousands.
Source code downloadHttp://down.bKjia. c
Mysql applications often use commands such as data backup, permission management, mysql stop and start, and some common database operation commands. I will sort them out below.
Remote Access
Mysql-h localhost-uroot-p
Change Password
Mysqladmin-uroot-proot password admin
If the original password is empty
Mysqladmin-uroot password admin
Displays the version number, status, and process information.
Mysqladmin version status proc
Start the service
Net start mysql
Close service
Mysqladmin-uroot-proot
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.