PHP file Programming (ii)-Four ways to read files

Read file $file _path= "Text.txt"; if (!file_exists ($file _path)) { echo "file does not exist"; Exit (); } Open File $FP =fopen ($file _path, "A +"); Read file $content =fread ($

PHP Picture Counter Code (enhanced version)

Session_Start (); $dir = ' cookie.txt '; $file = fopen ($dir, ' R '); $content = fgets ($file); Fclose ($file); if (Empty ($_session[' viewer '])) { $content + +; $newopen = fopen ($dir, ' w '); Fwrite

PHP Programmer face Test (classic summary, MySQL-based)

mysql_query ("BEGIN"); mysql_query ("INSERT into CustomerInfo (name) VALUES (' $name 1 ')"; mysql_query ("Select * from ' OrderInfo ' where customerid=". $id "); mysql_query ("COMMIT"); Copy Code5), lock table,

PHP mysql Add user (registration) code example

This article introduces, PHP and MySQL implementation to add the user, that is, the user registration function of a piece of code, the need for friends, refer to the next.This paper introduces the method of implementing the user registration

PHP file Programming (iii)-Two ways to write files

/** * PHP file programming to write files * Edit bbs.it-home.org */ Write a file $file _path= "Text.txt"; if (!file_exists ($file _path)) { echo "file does not exist"; Exit (); } "

Discussion: Several ways to crawl pages in PHP

$url = ' http://t.qq.com '; $lines _array=file ($url); $lines _string=implode (', $lines _array); Echo htmlspecialchars ($lines _string); Copy Code2. The file_get_contents () function uses file_get_contents and fopen

PHP Open gzip page does not output the workaround

output_buffering = Off Output_handler = Zlib.output_compression = On Copy CodeEnables gzip acceleration for all-station PHP files.For HTML files, you can configure the. htaccess file to handle HTML requests by PHP

Introduction to how PHP exports Excel and solves garbled problems

Header ("Content-type:application/vnd.ms-excel"); Header ("Content-disposition:attachment;filename=export_data.xls"); echo "Name". " \ t "; echo "Complex". " \ t "; echo "blog". " \ t "; echo "\ n"; echo

code example of PHP regular expression reading XML data

Zhang Ying male - Tank male - Copy Code2, PHP

Automatically identify the browser language to switch between English and Chinese (PHP and JS version)

Error_reporting (e_all ^ e_notice); Analyzing the properties of a http_accept_language Only the first language settings are available here (others can be enhanced as needed) Search and organize bbs.it-home.org Preg_match (

PHP-based Process Control statements

a=11; if (a>10) { echo "A>10"; } Copy CodeB, multi-branch: Basic syntax:if (conditional expression) {Statement//.....;}else{Statement//.....;}C, multiple branches: basic syntax:if (conditional expression) {statement;

PHP gets the encoded format of the string function

$encode = mb_detect_encoding ($string, Array ("ASCII", ' utf-8′, "gb2312′," GBK ", ' big5′)); Echo $encode; Copy CodeSo you know what encoding format it is.In addition, if you want to transcode it, you can refer to the following code:

Example of gzip file or string decompression in PHP

/** * PHP Custom Gzdecode uncompressed gzip file * Edit bbs.it-home.org */ if (!function_exists (' Gzdecode ')) { function Gzdecode ($data) { $flags = Ord (substr ($data, 3, 1)); $headerlen = 10; $extralen = 0;

CentOS 5.x system Yum upgrade PHP to 5.2.x method (test available)

gpg

# RPM--import Http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka Copy Code# Vi/etc/yum.repos.d/centos-base.repo Add the following information [Utterramblings] Name=jason ' s utter ramblings Repo

Example of how to encode all files under PHP conversion folder

/** * Convert folder encoding for all files * @param string $filename * @edit bbs.it-home.org */ function Iconv_file ($filename, $input _encoding= ' GBK ', $output _encoding= ' Utf-8 ') { if (file_exists ($filename)

How PHP prevents constants from being repeatedly defined

Prevent constants from repeating definitions, borrowing from Yii Defined (' Yii_debug ') or define (' Yii_debug ', true); Defined (' Yii_trace_level ') or define (' Yii_trace_level ', 3); Edit bbs.it-home.org ?> Copy

Examples of ways to zoom in and out of a PHP picture

/** * Image magnification and zoom * @resizeimage * @param $srcfile source file size * @param $mySize the dimensions to convert * Edit bbs.it-home.org * at 2013/6/7 */ function Resizeimage ($srcfile, $mySize) {

PHP code example to implement user registration

This article introduces, PHP implementation of the user registration information detection and storage examples, there is a need for friends to refer to it.The code is as follows: Query (' Set names gb2312 '), if (Empty ($conn)) {die

Phpmailer Send the example of NetEase 126 mailbox

This article describes the use of Phpmailer to send netease 126.com Mail example, there is a need for friends reference.Examples of sending e-mails using the Phpmailer class: ISSMTP ();//mail server $mail->host = "smtp.126.com";

A simple example of Php curl post

!--? php //curl Post Example $url = ' http://bbs.it-home.org '; $param 1 = "param1";//Parameter 1 $param 2 = "param2";//Parameter 2 $param 3 = "param3";//Parameter 3 $params = '

Total Pages: 5208 1 .... 4810 4811 4812 4813 4814 .... 5208 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.