Simple PHP code for Baidu online drive files

Baidu's online storage is fast and stable, and you deserve it. If you support direct connection in the future, you can directly use Baidu's online storage. The temporary solution is provided here, which cannot be used in the future. Set the

PHP encoding format setting method

A. if you want to use gb2312 encoding, PHP needs to output the header: Header ("Content-Type: text/html; charset = gb2312 "), add to the static page. All files are encoded in ANSI format and can be opened in notepad, to overwrite the source file.

PHP recursive Return Value Problem Solution

When we use PHP recursion, we will encounter various problems, among which the most distressing is the problems related to PhP recursive return values. In fact, it is very easy to think about it. But this simple problem has plagued us for half an

Use line breaks and (\ n or \ r \ n and BR) Applications in PHP code

CodeA: Copy codeThe Code is as follows: Echo 'Hello '; Echo 'World! '; ?> Output:HellloWorld!Code B:Copy codeThe Code is as follows: Echo 'Hello \ n'; // \ n for Unix systems; \ r \ n for Windows systemsEcho 'World! ';?>

PHP Directory Functions

Predefined constants: DIRECTORY_SEPARATOR (string): Directory Separator PATH_SEPARATOR (string): path Separator Bool chdir (string $ directory)-Change directory Copy codeThe Code is as follows: Echo getcwd (). "\ n ";Chdir ('Public _ html ');Echo

You don't have permission to access/index. php on.

Today, when testing the PHP integrated environment Apache server, everything is normal. When converting the virtual directory, a sudden error message "You don't have permission to access/index. php on. "In any case, the system cannot browse normally.

How to define and use constants in PHP

1. Custom Constants * Must be defined using the define () function* After definition, the value cannot be changed.* The constant name is used directly. You cannot add $ s in front of a variable.For example: define ("PI", 3.14); defines a constant$

Website failure caused by permission issues in the Temp folder in the iis php Environment

I don't know why a few days ago, the server is getting worse... The server is very slow. After windows is restarted, the server cannot be connected. As a result, we went to the data center. No problem found. GHOST restores the system. A few days

PHP uses the CURL method to POST data to the API code

In fact, it is also relatively simple, on the Code: Copy codeThe Code is as follows: $ Url = 'HTTP: // 127.0.0.1/test. php'; // The Link pointed to by POST$ Data = array ('Access _ token' => 'thekeyvalue'); $ Json_data = postData ($ url, $ data )

Php function code for intercepting strings and retaining the complete xml tag

Copy codeThe Code is as follows: /** * Author: goosman * Blog: http://blog.csdn.net/lgg201 * Mail: lgg860911@yahoo.com.cn */ $ Str = '2017 012 100 ';Function substr_remain_tag ($ s, $ o, $ l ){$ Is_match = preg_match_all ( # This regular

Use _ autoload () in php to automatically load the implementation code of undefined classes

The following code uses _ autoload () for your reference: Copy codeThe Code is as follows: /** * Automatically load related library files */ Function _ autoload ($ classname ){ If (substr ($ classname,-6) = "Action "){ Include APP_PATH.

Php array deduplication Function Code

Copy codeThe Code is as follows: Function assoc_unique ($ arr, $ key ){ $ Tmp_arr = array (); Foreach ($ arr as $ k =>$ v ){ If (in_array ($ v [$ key], $ tmp_arr )){ Unset ($ arr [$ k]); } Else { $ Tmp_arr [] = $ v [$ key]; } } Sort ($ arr )

Summary of common Special operators and functions in PHP (required for beginners of php)

Annotation symbol:// Single line AnnotationMultiline AnnotationUse of quotation marks''Single quotes, a simple string that can be taken without any processing;"" Double quotes, php dynamic processing and output, usually used to process $

PHP Output Time Difference Function Code

PHP Output Time Difference Function Copy codeThe Code is as follows: Date_default_timezone_set ('prc'); // Default Time Zone Echo "Today:", date ("Y-m-d", time (), " "; Echo "Today:", date ("Y-m-d", strtotime ("18 June 2008"), " "; Echo "yesterday:"

Code for hierarchical processing of Infinitely hierarchical PHP array data

Copy codeThe Code is as follows :/** * Create a parent node tree Array * Parameters * $ Ar array, data organized in the form of an adjacent list * $ Subscripts or associated key names used as primary keys in the id Array * $ Subscript or associated

PHP generates a unique promotion/discount code (with source code)

Every e-commerce website now has one or more types of discount/coupon systems to share with you how to generate a unique promotion/discount code in PHP. A promotional code system is used to track user sources. For example, a promotional code is

Php retrieves xml data submitted through http post and parses xml

How does php obtain the xml data of the request, the xml data submitted by the other Party through the http post protocol, and how does php obtain the xml data? Copy codeThe Code is as follows: $ Xml_data = ' '. ' '. ' 1234567890 '. ' lgsoftwares '

PHP-domain name query using hichina Interfaces

Today, when I made a website for someone else, I had to have the domain name query function. I checked some information and wrote a simple query function. The front-end page uses checkbox and the code is as follows: Copy codeThe Code is as follows:

Php Singleton mode implementation (the object is created only once)

A singleton class has at least three common elements: You must have a constructor and be marked as private.Static member variables of an instance that stores classes.Has a public static method to access this instance For more information, see the

Disable IE and Firefox cache using php

I found many methods in the network speed, and finally solved the problem. In fact, the simplest way is to add a tag to the header. You can also use Program Control Copy codeThe Code is as follows: Header ("Cache-control: no-cache, no-store,

Total Pages: 12780 1 .... 7276 7277 7278 7279 7280 .... 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.