54 ways to improve the efficiency of PHP program operation, 54php program operation efficiency
1. In the case of file_get_contents instead of file, fopen, feof, Fgets and other series of methods, try to use file_get_contents, because he is much
The program is as follows: $ file_name = "info_check.exe"; $ file_dir = "/public/www/download/"; if (! File_exists ($ file_dir. $ file_name) {// check whether the file exists echo "the file cannot be found"; exit;} else {$ f program is as follows:
$
PHPcodefunctiondownload_file ($ filename) {belowtoprovidethedownloadif (file_exists ($ filename) {php file download problem
PHP code
function download_file($filename){ //below to provide the download if
PHPcodefunctiondownload_file ($ filename) {// belowtoprovidethedownloadif (file_exists (php file download problem
PHP code
function download_file($filename){ //below to provide the download if (file_exists($filename)) {
A simple php file download source code, although not support the continuation of the breakpoint, but can meet some common needs. PHP download files can actually be implemented with a tag, such as Magento-1.8.1.0.zip. However, some browsers can
I want to add a file upload download function, because the file may be large, so the idea is to store the file in the database path on the server, download the file according to the path read. At the beginning of the upload page file list displays
Error handling is an important part of creating scripts and Web applications. If your code lacks error detection coding, then the program looks unprofessional and opens the door to security risks. This tutorial introduces some of the most important
The eof () function checks whether the object has reached the end of the object (eof). If the object pointer to EOF or an error occurs, TRUE is returned. Otherwise, an error (including socket timeout) is returned. In other cases
The eof () function
We often see this statement: $ file = fopen ($ filename, 'r') ordie ("negative loss, cannot open: $ filename"); or here we know this, because the data types are not differentiated in PHP, $ file can be int or bool. Therefore, such statements do not
Summary of some strategies of PHP program efficiency optimization, PHP Efficiency Strategy Summary
1. In the case of file_get_contents instead of file, fopen, feof, Fgets and other series of methods, try to use file_get_contents, because he is much
[PHP] back to base (IO stream), back to IO
IO streams are used to process data transfer between devices
The Java operation of the data is streamed through the way
The objects that Java uses to manipulate the flow are in the IO Package
There are two
Common File operation functions in php. Summary of common functions used for php file operations, including file read/write, creation, viewing file attributes, file deletion, and other file operations. Summary of common functions used for php file
PHP capture errors first look at the code. it is very simple to save the betys image data submitted by FLASH. Function & nbsp; customError () & nbsp ;{& nbsp; & nbsp ;}set_error_handler ("customError"); $ destination_folde PHP catch errors
First
fopen ()and the use of fclose ()1. The use of the fopen () functionThe fopen function is used to open a file in a format that is: File *fopen (char *filename, *type); The first form parameter in the fopen () function represents the file name, which
Copy codeThe Code is as follows:Ini_set ("memory_limit", "50 M"); // required. Try to avoid errors based on the actual environment conditions.Ini_set ("maid", "100 ");// The file_exists () function checks whether a file or directory exists. If yes,
Copy codeThe Code is as follows:$ File = fopen ("11.txt"," r ") or exit (" Unable to open file! "); // Open the file using fopen. If the file does not exist, it cannot be opened.$ Filesize = filesize ("11.txt"); // calculates the file size.Echo
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.