In PHP, the common way to find multi-dimensional arrays is recursively, as in the following code
$count =0; $sum = 0;function Avgarr ($arr){Global $sum, $count; Global variablesforeach ($arr as $value) {//Loop traversal arrayif (Is_array ($value)) {
The so-called Sina callback interface, is when the capital recharge success, Sina will inform this website a message to inform already recharge success, and return a group of successful array, we based on this data to a local database
PHP filter special characters and SQL anti-injection codeMethod OneFilter ', ', SQL nameAddslashes ();
Method Two, remove all HTML tags
Strip_tags ();
Method three filters may generate code
function Php_sava ($STR){$farr = Array ("/s+/","/]*?) >/
SQL injection attacks are the most common means by which hackers attack Web sites. If your site does not use strict user input test, it is often easy to be SQL injection attacks. SQL injection attacks are usually implemented by submitting bad data
In PHP, the TRIM function can only replace the left and right sides of the space, feeling in some cases not very good, if you want to be a string of all white space characters filter out (spaces, full-width spaces, newline, etc.), then we can write
Sometimes you need to filter out the extra tag attributes, such as the IMG tab that filters out all attributes except the SRC attribute, such as deleting titile alt attributes and some of the foot onclick properties.
For example, to filter all
Directory_separator is a command that displays the system separator, directory_separator is the internal constant of PHP and can be used directly without any definition or inclusion.
As we all know, under Windows the path separator is (of course/on
First, the question:
The database is Ms SQLServer2000, to the SQLServer2000 of a table of data into the MySQL5, where SQLServer2000 table fields in Simplified Chinese name (strongly recommended not to do in Chinese as field name). In fact, the
The code is as follows
Copy Code
MYSQL_INSERT_ID ()The mysql_insert_id () function returns the ID generated by the previous insert operation. If the previous query does not produce a auto_increment ID, mysql_insert_id () returns 0.
PHP + jQuery Ajax File upload instance. Because see some friends ask how to implement the PHP environment of the Web page upload function, oneself these days just used the jquery_upload_multiple upload plug-ins, so here to use for everyone to say.
Example 1
Recently in writing ANE-commerce website, in the shopping cart when found in PHP does not have a map of this data structure, we can not simply through a hashmap to implement the shopping cart, so I think of the array, through the format
The CType function is a string-body-testing function built into PHP. Mainly has the following several
Ctype_alnum--Check for alphanumeric character (s)Detect if it contains only [a-za-z0-9]
Ctype_alpha--Check for alphabetic character (s)Detect if
Ajax application simple test system problem: Welcome to use this test system. Click Start! answer: Tip: Ajax. js fileVar ajaxreq = false, ajaxCallback;Function ajaxRequest (filename ){Try {Ajaxreq = new XMLHttpRequest ();} Catch
PHP SimpleXMLSimpleXML processes the most common XML tasks and blades, with other extensions.What is SimpleXML?SimpleXML is the new PHP 5. This is a simple way to get the attributes and text of a element, if you know the layout of the XML
There are several types of user comments or advertisements for other content:1: Taobao part-time and QQ 123456789 group (with QQ number, WeChat number, or other digital numbers)2: taobao part-time job, plus QQ number (with English keywords)3: Taobao
There may be several reasons for this error. The answer to the online search is basically targeted. The key is how to find the cause and solve it.Analysis 1: encoding error during data storage and deserializationThis is very common, for example,
The code is as follows:Copy code // Function name: CheckEmailAddr ($ C_mailaddr)// Usage: determines whether the email address is a valid email address.// Parameter: $ C_mailaddr (email address to be detected)// Return value: Boolean// Standby
The code is as follows:Copy code Session_start ();$ Con = mysql_connect ('localhost', 'root', 'root') or die ('database connection failed! ');Mysql_query ('set names utf8 ');Mysql_select_db ('guestbook ');$ Pagesize = 10; // The number of
Data types in PHPFour scalar types:Boolean (boolean)Integer)Float (float, also called double)String (string)Two composite types:Array)Object)There are two special types:Resource)NULL)To make sure the code is easy to understand, this manual also
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