PHP File Processing ~ ~ Learning Notes
the fopen function is used to open the file in PHP.
The first parameter of this function contains the name of the file to be opened, and the second parameter specifies which mode to use to open the
The code is as follows
Copy Code
$con = mysql_connect ("localhost", "root", "222222");if (! $con){Die (' Could not connect: '. Mysql_error ());}echo "Success"Mysql_close ($con); Close connectionVar_dump ($row); Print outPrint_r ();
C-language file pointer (similar to Java in document file = new file ();)In the C language, a pointer variable is used to point to a file, which is called the file pointer format: The pointer variable identifier;Opening of the
1, Mime_content_type () function to judge get file type
Mime_content_type returns the MIME type of the specified file.
Usage:
The code is as follows
Copy Code
Echomime_content_type (' Php.gif '). " n ";Echomime_content_
The pages that generate static pages are very simple to define templates and template headers, and then replace them with Str_replace, which is the most common method, the other is to use ob_get_contents output to generate HTML, and one of the less
This example describes the way PHP uses the Fputcsv () function CSV file to read and write data. Share to everyone for your reference. The specific analysis is as follows:
The Fputcsv () function is used to format data in CSV format for writing to
Copy codeThe Code is as follows:/*Function: (a) delete a file (B) edit a file, and delete a folder on a webpage (c), provided that the folder is empty (d) create a file or folder, modify the folder name;Lost63.com original, reprinted please indicate
This article mainly introduces three common methods for generating static pages in PHP dynamic pages. Three different methods can be used to achieve this function from different perspectives, which provides great reference value, for more
File manipulation has always been a headache for web programmers, and file operations are necessary in systems such as CMS. Now, the php file operation function content is very powerful, the file is also a very important part of learning PHP, I hope
Php provides a detailed description of csv file reading, writing, and output download operations. Copy the code as follows :? Php?filefopen(text.csv, r); while ($ datafgetcsv ($ file) {print_r ($ data) is used to read a line of content in the CSV
PHP Error Handling
When we develop the program, sometimes there is a problem with the program, we can use the following methods to find out the error.
Development phase: Output all error reports at development time, which will help us to debug the
Small series of PHP for beginners today to introduce PHP file operations commonly used methods summary, including: file read and write, create, view file properties, file deletion and so on the operation of the file.
Before accessing a file, we
CopyCode The Code is as follows: /*
Function: (a) delete a file (B) edit a file, and delete a folder on a webpage (C), provided that the folder is empty (d) create a file or folder, modify the folder name;
Lost63.com original, reprinted please
1. open the file: fopen ("file name", "Mode ");
Mode:
R: Read-OnlyR +: read/writeW: Write only. Open and clear the file content. If the file does not exist, create the file.W +: read/write. Open and clear the file content. If the file is not saved,
Wzskynet # 163.com
· Php escapeshellcmd multi-byte encoding vulnerability
· Explain in detail the application of the cache technology in PHP
· Use PHP V5 to develop multi-task applications
· Detailed parsing of PHP data sending process to MySQL
·
This article mainly introduces three common methods for generating static pages in PHP dynamic pages. three different methods can be used to achieve this function from different perspectives, which provides great reference value, if you need a
Detecting file types
function Checkfiletype ($fileName) {
$file = fopen ($fileName, "RB");
$bin = Fread ($file, 2); Read-only 2 bytes
Fclose ($file);
c is an unsigned integer, the net search is C, signed integer, this will
Summary of some policies for optimizing php program efficiency, and summary of php efficiency policies. Summary of some policies for optimizing php program efficiency, and summary of php efficiency policies 1. when file_get_contents can be used to
The page for generating static pages is very simple: Defining the template and template title, and then replacing it with str_replace, which is the most common method, the other is to use the ob_get_contents output to obtain and generate html, and
PHPfopen () and file_get_contents () applications and differences. Copy the code as follows: export filefopen(11.txt, r) orexit (Unabletoopenfile !); Open the fopen file. if the file does not exist, it cannot be opened. $Filesizefilesize(11.txt );
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.