Php prohibits access to the. php file directly from the address entered in the browser.

For example, my http://www.111cn.net/xx. php file I don't want anyone to access directly from a browserBut if you connect to http://www.111cn.net/xx. php from any website, you can accessThe connection established on the local machine cannot be

PHP bubble sorting program code and source code

Introduction to bubble sorting:Bubble Sort is a simple sorting algorithm in the computer science field.It repeatedly visits the series to be sorted, compares two elements at a time, and exchanges them if their order is wrong.The work of visiting a

PHP implementation of object download instance code

To download a simple object, you only need to use the HTML connection tag and specify the URL value of the href attribute as the downloaded object. The code is as follows: The code is as follows:Copy code download file If you download the

3 Methods for passing parameters in php CLI (command) mode

There are three methods for passing parameters in CLI (Command Line Interface.1. getopt function (PHP 4> = 4.3.0, PHP 5)Create a File: The test1.php code is as follows:$ Opt = getopt ('M: n :');Print_r ($ opt );?>Then run the commandPhp

PHP static page implementation scheme (Template tag)

Solution: Use the template replacement technology (no time delay) The code is as follows:Copy code /*| ------------------| | ------------------*/$ Users = $ _ POST ['users']; // add operationIf ($ region = 'ADD '){$ Title = $ _ POST ['title'];$

The best way for php to read large files

The code is as follows:Copy code Read the last few rows of data from a large file:/*** Get the last $ n lines of the file* @ Param string $ filename File path* @ Param int $ n the last few rows* @ Return mixed false indicates an error occurred.

Five programming habits for PHP performance optimization

1. Do not copy variables at will.Sometimes, in order to make PHP code more clean, some new PHP users (including those who follow the rules themselves) will copy the predefined variables to a variable with a shorter name, in fact, the result is a

PHP cyclically determines whether the string contains the array value

Example The code is as follows:Copy code Function is_exist ($ str, $ key ){Foreach ($ key as $ v ){If (strpos ($ str, $ v)>-1 ){Return true;  } }Return false;}$ Str = 'abcdefg US China ';$ Key = array ('4', '5', 'A ');If (is_exist ($ str, $ key )

In php, the UTF8 string is split into single words and returns an array (including Chinese characters)

The code is as follows:Copy code $ Tempaddtext = "php splits UTF8 font strings into single words and returns an array ";  $ Cind = 0;$ Arr_cont = array ();For ($ I = 0; $ I If (strlen (substr ($ tempaddtext, $ cind, 1)> 0 ){If (ord (substr ($

In-depth analysis of PHP article content paging

There are two main methods to pagination the article content:Method 1. Paging by word countPaging by words is easy to use, but the effect is poor.General Idea: first, set the maximum number of words per page. Then, calculate the total number of

PHP is the easiest way to verify Email and IP addresses

Check whether a user has entered a valid email address. The simplest method is to use the PHP built-in function filter_var (), which can check the email address. The code is as follows:Copy code Filter_var ('sgamgee @ example.com ',

$ _ SERVER [PATH_INFO] variable usage in php

Conclusion test environment:Ubuntu Server 14.04PHP Version 5.5.9-1ubuntu4Apache/2.4.7 (Ubuntu)PATH_INFO is a parameter in the SERVER Status. You can view the content through $ _ SERVER ['path _ info. In addition to PATH_INFO, the $ _ SERVER array

Php deletes the folder and the file program code in the folder

Before learning this method, we use the rmdir () function. This function deletes a file or folder based on the specified file path. However, when a folder is deleted, when there is still content in the folder, the Directory not empty error will

Clear all space programs in the article in php

Remove all spaces The code is as follows:Copy code Function delete ($ str ){$ Str = trim ($ str );$ Str = ereg_replace ("\ t", "", $ str );$ Str = ereg_replace ("\ r \ n", "", $ str );$ Str = ereg_replace ("\ r", "", $ str );$ Str = ereg_replace

Php date to Chinese program code

If we use the date function to obtain the number displayed on the date The code is as follows:Copy code Echo date ("Y-m-d ");?> Output2014-10-11If we wantOctober 11, 2014What should I do? Later I saw a friend write a sentence function. The

In php, socket implements GET and POST asynchronous data submission

Socket Extension in windowsIn windows, you can directly modify the php. ini file to remove it.Extension = php_sockets.dllRestart with the semicolon.Install socket extension for PHP in linux The code is as follows:Copy code # Cd/home/php5.2.1/ext/

Php + ajax implementation of image file Upload instance code

Method 1: upload a file using jquery ajaxfileupload. jsIn fact, it is to implement the upload of non-refresh files. The IFRAME file Upload principle can be used.In fact, when using PHP to upload files... You can only use $ _ FILES, but if we only

Php multi-process example

The implementation of php multi-process depends on the pcntl extension. During PHP compilation, you can add '-enable-pcntl' or compile it separately.Note the following three points:1. The sub-process does not execute the code before fork, but just

PHP preliminary interview questions

I. Front-endWhat is the engine used by Firefox and google? (At least the basics of the previous section, the compatibility of the browser for stream adjustment is required. It is also required to use CSS3 and HTML5)Firefox uses Gecko, while Safari

Php timestamp conversion date method summary

CURRENT TIMESTAMP The code is as follows:Copy code $ Nowcode = time ();$ Nowcode = strtotime (now ); Time stamp converted to date The code is as follows:Copy code $ Date = date ("Y-m-d", getdatecode ($ )); Convert date to timestamp The

Total Pages: 12780 1 .... 8780 8781 8782 8783 8784 .... 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.