Php forcibly downloads the code of a specified type of file
// Download prompt
// Site http://bbs.it-home.org
Function downloadFile ($ file ){
/* Coded by Alessio Delmonti */
$ File_name = $ file;
The stored code is directly prompted when the phpheader function file is downloaded.
$ Filename = 'path + actual filename ';
// File type
Header ('content-type: application/pdf ');
// Download the
Principles and code of uploading PHP image files
Php code uploads files or images, analyzes the upload principles for everyone, and provides specific code. it is recommended that you refer to and learn for beginners.1. create a file upload
Get operating system
// Operating system
Public function getOS (){
$ Agent = $ _ SERVER ['http _ USER_AGENT '];
$ OS = false;
If (eregi ('win', $ agent) & strpos ($ agent, '95 '))
Are you a programmer or a programmer?
Now I deeply understand that not only are there great differences between people, but also between programmers and programmers.Ordinary programmers simply complete their own tasks. after the tasks are
PHP class variables and members, and issues to be aware of during inheritance, access, and rewriting
Class Myclass {
Public $ prop = 123;
}
$ Obj = new Myclass ();
?>
The member
Php code for generating a dynamic image verification code
Session_start ();
Function random ($ len)
{
$ SrCStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ";
$ Strs = "";
For ($ I = 0; $ I
{
Php code used to extract an image file and display it on a browser
$ Size = getimagesize ($ filename); // Obtain mime Information
$ Fp = fopen ($ filename, "rb"); // open a file in binary mode
If (
Summary of php method for calling external shell
System ("/usr/local/bin/webalizer ");
?>
Exec ()Prototype: string exec (string command [, string array [, int return_var])The exec () function is similar to
Php uses curl to determine whether a remote file exists
// Determine the remote file
Function check_remote_file_exists ($ url)
{
$ Curl = curl_init ($ url );
// Do not retrieve data
Example of using phpword to generate a Word document in php
Require_once '../libs/PHPWord. php ';
Require_once '../libs/PHPWord/IOFactory. php ';
Require_once '.../../config. php ';
//
Php parses XML document attributes and edits the code
// Read xml
$ Dom = new DOMDocument ('1. 0 ');
$ Dom-> load ('data. XML ');
$ Em = $ dom-> getElementsByTagName ('videoos '); // outermost node
Php user-defined function recursively replaces the content in the array
/**
Desc: recursively replaces array content
Link: bbs.it-home.org
Date: 2013/2/22
*/
Function arrContentReplact
An example of how to define a php long string (heredocument)
$ Xx =
I am not long,
I am not long,
I am not long ,?
Script school http://bbs.it-home.org
Html;
A php code that accurately counts the number of online users
Using filename='online.txt '; // data file
$ Cookiename = 'vgotcn _ onlinecount'; // cookie name
$ Onlinetime = 600; // online validity
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