PHP on the form to submit special characters of the processing method to do a summary, mainly related to Htmlspecialchars/addslashes/stripslashes/strip_tags/mysql_real_escape_ Several functions, such as String, are used jointly to communicate with
Copy Code code as follows:
/**
*
* Separate the array by the specified number
* @param array $array to split
* Number of groups @param int $groupNum points
*/
Public Function Splitarray ($array, $groupNum) {
if (empty ($array)) return
In the process of using PHP, it is unavoidable to use the header and Setcookie two functions, these two functions send a piece of file header information to the browser, but if you have any output (including null output, such as a space, carriage
PHP 5.4来, which is another major version upgrade since 5.3. This upgrade is more significant, removing some of the over gas function, bringing speeds up to 20% and less memory usage.
New features and changesKey new features of this update include:
More and more Web sites want users to register with the mailbox, or to bind the mailbox, this time to confirm the correctness of the mailbox, some people use to send mail to activate the way to judge, thus activating an account, but there is a
PHP data type
PHP supports eight original types (type).
Four scalar types:
String (strings)
Integer (integral type)
Float (floating-point type, also double)
Boolean (Boolean)
Two types of composite:
Array (arrays)
Object (Objects)
Two special
When PHP is developed, when you use empty to check the results returned by a function, you will get an error: Fatal error:can ' t usage function return value in write context
For example, the following code:
Copy Code code as follows:
echo
PHP Introduction:PHP's unique syntax blends C, Java, Perl, and PHP's own syntax. It can execute Dynamic Web pages more quickly than CGI or Perl. Dynamic pages made with PHP compared to other programming languages, PHP embeds programs into HTML
Copy Code code as follows:
?
Date_default_timezone_set ("etc/gmt-8");
$tm =time ();
echo Date ("Y-m-d h:i a", $TM);
echo "";
echo Date ("Y year M month D Day", $TM);
?>
PHP's default time zone UTC time zone, while Beijing is located
We can use the following code to test:
Copy Code code as follows:
$filename = ' test.txt ';
if (Is_file ($filename)) {
echo "$filename exists!\n";
} else {
echo "$filename no exists!\n";
}
Sleep (10);
if (Is_file
For example, the following Web application might display sensitive information to the login user:
Copy Code code as follows:
$authenticated = FALSE;
$authenticated = Check_auth ();
if ($authenticated)
{
Include './sensitive.php ';
}
?
Experienced programmers found that PHP judged the length of the string, using Isset () faster than strlen () and executing more efficiently.That
Copy Code code as follows:
$str = ' aaaaaa ';
if (strlen ($STR) > 6)
Vs
if (!isset (
Copy Code code as follows:
Delfile ("Upload", 10);
function Delfile ($dir, $n)//delete all files created by n minutes before the dir path;
{
if (Is_dir ($dir))
{
if ($dh =opendir ($dir))
{
while (false!== ($file = Readdir ($DH)))
{
if (
Include () and require (): The statement includes and runs the specified file.Include () produces a warning and require () causes a fatal error. In other words, if you want to stop processing the page when you encounter a missing file, use require ()
Maybe you know, maybe you don't know, PHP is a weakly typed, dynamic scripting language. The so-called weak type, that is, PHP does not strictly verify the variable type (strictly speaking, PHP is a medium-strong type language, this part will be
This warning is sometimes present in writing PHP programs:
PHP warning:date (): It isn't safe to rely on the system's timezone settings. You are are *required* to use the Date.timezone setting or the Date_default_timezone_set () function. In case
PHP Starts the error
Copy Code code as follows:
[ROOT@ABC lnmp]# Service php-fpm start
Starting PHP-FPM eaccelerator:could not allocate 67108864 bytes, the maximum size of kernel allows is 33554432. Lower The amount of memory
PHP itself does not provide a function to return the number of milliseconds, but provides a microtime () function that returns an array containing two elements, one in seconds and the number of milliseconds in decimal notation, which makes it easy
1 using JS to achieve
Copy Code code as follows:
if (! $this->userinfo) {
$alert _msg = "Activate link error";
echo " ';
Redirect (Base_url ());
Die
}
2 PHP implementation
Copy Code code as follows:
if (!
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