Copy CodeThe code is as follows:
$path = $DOCUMENT _root;
$path =str_replace ("/", "\ \", $path);
Specify folder
$path = $path. " \\web\\study\\ ";
Get all the files
$s =explode ("\ n", Trim (' dir/b/o:gn $path '));
Get all the HTML file names
A The first is the PHP page encoding1. The encoding of the PHP file itself should match the encoding of the Web pageA. If you want to use gb2312 encoding, then PHP will output headers: header ("content-type:text/html; charset=gb2312 "), static page
Add ($key, $value, $expiry);
$key: Unique identity, used to differentiate written data
$value: Data to write
$expiry: Expiration time, default is always valid
Purpose: Writes data to Memcache
Get ($key)
$key: Get the corresponding data by $key at
1. Preface
Pagination display is a very common way to browse and display large amounts of data, which is one of the most frequently handled events in Web programming. For the veteran of Web programming, writing this code is just as natural as
In web development, we often cache time-consuming operations of our database, but there may be a trap, in the event of a cache failure, a large number of access to cache invalidation of the flag, all go back to query the database, resulting in a
Date--Formatting a local time/date
Gmdate--Formats a GMT/UTC date/time and returns Greenwich Mean Time (GMT).
For example, we are now in the time zone is +8, then the server run the following script to return the time should be this:
The current
The following regular:
$a = ' 2
tóng
dòng
Canton 3 ';echo preg_replace ('/[^ /', ', $a);
Will prompt:
Warning:preg_replace (): Unknown modifier ' P ' in E:\phpLearn\test.php on line 12
1, how do I connect a string of two strings?
A: Connecting two strings in PHP can be used directly with "." Operation symbols, such as $newstr= "Zhang". " San ", which is used in Java with the" + "operation symbol, do not confuse.
2, how to
Recognize and use PHP Super global variables
The super global variable, also known as a predefined variable, is a self-contained variable in the PHP system, which makes your programming easier and faster. The types of this
PHP Get file name
Copy CodeThe code is as follows:
function Retrieve ($url)
{
Preg_match ('/\/([^\/]+\.[ a-z]+) [^\/]*$/', $url, $match);
return $match [1];
}
PHP Get file name extension
Copy CodeThe code is as follows:
function Getext ($url)
{
Below I green Apple to take everyone into the path of getting into PHP
Description
For the time being, I am using Apache Web server and my SQL as the Web servers and databases, under the environment of php-4.3.3. Of course, simple to build and
Smarty can encode URLs directly, such as
But in the smarttemplate as if there is no, because the link is submitted by JS, not the form submission, so it cannot be automatically encoded.
Workaround: Use JS to the URL of the Chinese character escape
Copy CodeThe code is as follows:
/*
$Id: phpzip.php
*/
Class Phpzip {
var $datasec = array ();
var $ctrl _dir = Array ();
var $eof _ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00";
var $old _offset = 0;
function Zip ($dir, $zipfilename) {
if
Copy CodeThe code is as follows:
Get the current script URL
function Get_php_url ()
{
if (!empty ($_server["Request_uri"))
{
$scriptName = $_server["Request_uri"];
$nowurl = $scriptName;
}
Else
{
$scriptName = $_server["Php_self"];
if (Empty
The output control function does not affect the header information sent using header () or Setcookie (), only data blocks that resemble Echo () and PHP code are useful.
Let's start with a simple example that gives you a general impression of the
Because PHP will search for variables in a string surrounded by double quotes, single quotes will not, note: only echo can do this, it is a string can be used as a parameter of the "function" (in the PHP manual that echo is a language structure, not
How to use:
Memcached
Copy CodeThe code is as follows:
$cache = new Cache_memcache ();
$cache->addserver (' www1 ');
$cache->addserver (' www2 ', 11211,20); This server has double the memory, and gets double the weight
$cache->addserver (' www3 ', 1
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