String interception
$a = "s@@ 你好";
Var_dump (Strlen_weibo ($a, ' utf-8 '));
The result output is 8, where the letter S count is 1, the full-width @ count is 2, the half-width @ count is 1, and two Chinese count is 4. The source code
echo "Today:", Date (' y-m-d h:i:s '), "";
echo "Tomorrow:", Date (' y-m-d h:i:s ', Strtotime (' +1 Day '));
?>
Copy CodeLast line output current time, next line output tomorrow timeHere +1 day can modify parameter 1 for any
$sudoapt-getinstallapache2
Copy CodeThen, run Apache: $sudo/etc/init.d/apache2restartApache will create a new directory during installation:/var/www, which is the root directory where the document is stored on this server. All documents
Default_charset= "gb2312", modify the default character set, here, if preceded by a semicolon ";", remove the semicolon;
The Register_globals=off is changed to Register_globals=on, making the transitive global variable valid;
Extension=
$string =mb_convert_encoding ($string, character output encoding, original character encoding);
Copy CodeFor example: Web pages use GBK encoding, strings are encoded using UTF-8, and characters are converted to Web page display
This article introduces the functions of escaping special characters commonly used in PHP MySQL programming, including the use of mysql_escape_string and addslashes functions, as required by the friend reference.
PHP MySQL escape function
if (Phpversion ()
Set_magic_quotes_runtime (0);
}
Copy Code>> cannot define MAGIC_QUOTES_GPC through functions, so it is recommended to open the server uniformly, when writing the program should be judged, to avoid the
What is PHP?PHP is an abbreviation for hypertextpreprocessor, and the PHP scripting language is an embedded HTML. PHP syntax is a unique mix of the C, Java, Perl, and PHP types of the new syntax. The purpose of this language is to allow web
Generate 4 digits, less than 0 of the preceding
$var =sprintf ("%04d", 2);
echo $var;//result is 0002
echo Date (' Y_m_d ', Time ()). ' _ '. sprintf (' d ', rand (0,99));
?>
Copy CodeThe sprintf ()
This article introduced the PHP server configuration detailed steps, the environment for Php+mysql+iis, grasp the PHP environment to build the method, the need for a friend reference.This section: How to build a PHP server environment.Software
This article describes some of the deprecated and outdated functions in PHP5.3 and 5.5, and everyone who is interested in using PHP functions as a reference.
Added a new error level deprecated from PHP5.3, which is about to be
CREATE TABLE Users (
Username VARCHAR (+) CHARACTER SET GBK,
Password VARCHAR (+) CHARACTER SET GBK,
PRIMARY KEY (username)
);
Copy Codeexample, simulates the case where the query data is escaped using only
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