Common session Problems in PHP

1, how to set a long life session?Will Session.cookie_lifetime, Session.gc_maxlifetime time set a little longer. 2, why does the initialization of the session when the error?A, check the storage path of the session file, the path is right, the

PHP Picture Statistics Device

Graphics Page Counter Example ? Php $ The code is as follows Copy Code Countfile = "Num.txt";Defines that the file written by the counter is count.txt under the current directory, and then we should test whether the

PHP Deletes a space in a string multiple ways

A function with PHP itself The code is as follows Copy Code Str_replace ("", "", $str);To replace The code is as follows Copy Code $str = "# #使用函数trim去掉字符串两端特定字符";$str 1 = Trim

PHP Web color Leveling Device code

?For ($y =0 $y {echo "n"; For ($x =0 $x {$abs 00=sqrt (($x * $x) + ($y * $y));if ($abs 00>16)$abs 00=16; $abs 01=sqrt (($x * $x) + ((16-$y) * (16-$y));if ($abs 01>16)$abs 01=16; $abs 10=sqrt ((16-$x) * (16-$x) + ($y * $y));if ($abs 10>16)$abs 10=1

How PHP creates a file instance code

*/ The code is as follows Copy Code $FN = ' Www.111cn.net.txt '$fcon = ' How PHP creates a file '; Contentif ($f =fopen ($FN, "w")){if (fwrite ($f, $fcon)){Echo ' Write a file successfully ';}Else{echo ' File not

PHP Filter SQL injection keyword analysis

Str_replace Replace update in SQL This is in itself a mistake for the following reasons: If you already have an update field in SQL, such as the following SQL The code is as follows Copy Code $sql = "Update content = '

PHP uses curl to mimic user acquisition of remote Web site content

The code is as follows Copy Code $timestamp = time ();function open ($file, $type = ') {Global $fromurl, $referer;$cachename = $file;if ($type) {$file = '/'. $type. ' /'. $file;}else{$file = $file;}if ($open =file ($file)) {$count

PHP http_referer fetch is not worth to forge a http_referer request

Simple about Http_referer One The code is as follows Copy Code $phpSelf = isset ($_server[' php_self '))? $_server[' php_self ']: $_server[' script_name '];$queryString = ';if (!empty ($_server[' query_string

PHP query specifies all files in the directory and save to array

The code is as follows Copy Code $dirs = Array ();foreach (Glob ("test/*") as $d){if (Is_dir ($d)){$dirs [] = $d;}}Print_r ($dirs); Method Two The code is as follows Copy Code Glob ("test/*",

PHP Json_encode, Json_decode and Serialize, unserialize

The efficiency of Json_encode and json_decode is not more efficient than serialize and unserialize, the performance is about twice times different when deserializing, PHP 5.3 performs more efficiently than PHP 5.2. The code is as follows

PHP is getting the address code of the URL

Method One The code is as follows Copy Code $str = ' ';Preg_match_all (' |^Print_r ($out); Method Two The code is as follows Copy Code Preg_match_all ('/href=[' "]+ (. *) [']+/',

PHP gets string uft-8 encoding

ord

Method One The code is as follows Copy Code echo preg_replace (' #[x{4e00}-x{9fa5}] #ue ', ' Chinese_unicode ("") ', "Hello, China");/guarantee "Hello, China" is utf-8.function Chinese_unicode ($c) {Return "U". Dechex

PHP File Download Application Example

The code is as follows Copy Code ?function Download ($file _dir, $file _name)Parameter description:File_dir: directory where files residefile_name: filename{$file _dir = Chop ($file _dir);//Remove extra spaces from the pathThe path

PHP File Upload Instance code

?if (! $UploadAction):?> The code is as follows Copy Code File Upload Interface " ?Else?> File Upload Code The code is as follows Copy Code ?$UploadAction = 0;echo

PHP Refresh Output Buffer code

function Throw_error ($message) {$error _page = "/err/error.php";$error _url = $error _page;$error _url. = "? redirect_error_notes= $message ";$error _url. = "&redirect_url=". $GLOBALS ["Php_self"];$error _url. = "&redirect_request_method= $REQUEST _

Practical methods for static variables of PHP static keywords (1/3)

The code is as follows Copy Code Class Foo{public static $my _static = ' foo ';Public Function Staticvalue () {Return self:: $my _static;}}Class Bar extends Foo{Public Function foostatic () {Return Parent:: $my _static;}}Print Foo:: $

Php method for filtering empty arrays and filtering elements with empty arrays

// Method 1 use array_filter to call our custom function to filter null values The code is as follows:Copy code Function clear ($){Return $ a <> "";}$ Array = array ("", '', 1 );$ Stt = array_filter ($ array, "clear "); Print_r ($ stt

PHP intercepts the specified image size instance code

Header ("Content-type: image/jpeg ");$ Filename = 'book_rabbit_rule.jpg ';/* Read the image file */$ Im = imagecreatefromjpeg ($ filename );/* How much image is to be cut, length/width */$ New_img_width = 120;$ New_img_height = 42;/* Create a new

Use ajax + php to call classic instances without refreshing data

ajax + php call classic instances without refreshing data // S. Php file$ Db = new Db ();$ Type = ($ action = 'esfpice ')? ;$ SQL = "Select * from cn_loupan_city_price where city_id = '$ Cid' and price_type =' $ type '";$ Query = $ Db-> query ($ SQL

Perfect php article paging

Class SubPages {Private $ each_disNums; // Number of Entries displayed on each pagePrivate $ nums; // The total number of items.Private $ current_page; // the currently selected pagePrivate $ sub_pages; // The number of pages displayed each

Total Pages: 12780 1 .... 6864 6865 6866 6867 6868 .... 12780 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.