PHP mandatory file download function code (any file format)

Copy codeThe Code is as follows:/********************* @ File-path to file*/Function force_download ($ file){If (isset ($ file) & (file_exists ($ file ))){Header ("Content-length:". filesize ($ file ));Header ('content-Type: application/octet-stream

Php xml data parsing code

Copy codeThe Code is as follows:// Xml string$ Xml_string = " Foo foo@bar.com Foobar foobar@foo.com ";// Load the xml string using simplexml$ Xml = simplexml_load_string ($ xml_string );// Loop through the each node of userForeach ($ xml-> user

Simple PHP message library instance code

Config. php Copy codeThe Code is as follows:$ Conn = @ mysql_connect ("localhost", "root", "") or die ("database connection error! ");Mysql_select_db ("gb", $ conn );Mysql_query ("set names 'gbk '");?> Add. php Copy codeThe Code is as

Use PHP to extract the FLASH Address Code from the video website page

Then I implemented this function using PHP. I think it is a pleasure to use PHP to do this job! With its powerful HTML page processing functions and regular expressions, you can use this function with just a few lines of code.Paste the key code:Copy

Php file_get_contents function to easily collect html data

Copy codeThe Code is as follows:// The country determines if $ REQUEST_URI contains htmlIf (! Strpos ($ _ SERVER ["REQUEST_URI"], ". html ")){$ Page = "http://qq.ip138.com/weather ";$ Html = file_get_contents ($ page, 'R ');$ Pattern = "/ online

PHP Image Upload implementation code with detailed notes

Copy codeThe Code is as follows:// Upload the image processing fileIf ($ _ FILES ["file"] ["type"] = "image/gif ") | ($ _ FILES ["file"] ["type"] = "image/jpeg ") | ($ _ FILES ["file"] ["type"] = "image/pjpeg ")) & ($ _ FILES ["file"] ["size"] If ($

Blitz templates: the fastest PHP template engine

Introduction:Blitz templates is a fast PHP template engine developed in C language. It serves as a PHP Extension function. It started to replace as a php_templates but grew to more work. It is based on scalable template controllers (custom view

The question of string segmentation in Chinese/English mixed numbers in php

I searched for some time on the Internet and found that nothing happened.Later, I thought of a solution, which is original.Only use the intercept and replacement functions.Copy codeThe Code is as follows:Function smssubstr ($ string, $ length ){If

DedeCMS core class TypeLink. class. php abstract notes

Note: '// +' indicates additional comments added to me.Class TypeLink{Var $ typeDir;Var $ dsql;Var $ TypeID; // + category IDVar $ baseDir; // + site root URLVar $ modDir; // + template directoryVar $ indexUrl; // + home page urlVar $ indexName; // +

PHP Socket programming

The following code is used:PHP code:Copy codeThe Code is as follows:// Set some basic variables$ Host = "192.168.1.99 ";$ Port = 1234;// Set the timeout valueSet_time_limit (0 );// Create a Socket$ Socket = socket_create (AF_INET, SOCK_STREAM, 0) or

Php Upload function instance code

1. Upload the form upload.html Copy codeThe Code is as follows: 1. note this is a tag. to upload a file, you must specify it as multipart/form-data. Otherwise, the server will not know what to do.2.The Value is the hidden Value range of the form

PHP5 string processing functions

Addcslashes-add backslash escape characters to some characters in the stringAddslashes-escape characters in the string in the specified MethodBin2hex-convert binary data to hexadecimal RepresentationAlias function of chop-rtrim ()Chr-returns the

10 uncommon but useful functions in PHP

1. sys_getloadavg () Sys_getloadavt () can obtain the system load. This function returns an array containing three elements, each representing the average load of the system in the past 1, 5, and 15 minutes.Instead of letting the server go down due

PHP code for capturing web images and saving them as images

The following are the source code and Related explanations.Copy codeThe Code is as follows:// The URL is the complete remote image address and cannot be blank. $ filename is the name of the saved image.// By default, images are stored in the same

Php + mysql authentication code

Copy codeThe Code is as follows:$ Uname = $ _ POST ["username"];$ Pwd = $ _ POST ["password"];$ Link = mysql_connect ('localhost', 'root', '123 ')Or die ('could not connect: '. mysql_error ());Mysql_select_db ('ruida ') or die ('could not select

PHP file reference skills

We know that java has the concept of a package, while. NET has a more convenient DLL Assembly reference concept, through these together in the form of packaging object set, we can easily reference classes or other objects defined elsewhere in our

THINKPHP + JS implement scaling image screenshot

Author: Yang xinqi Original: http://www.cnblogs.com/scotoma/archive/2010/03/05/1679477.html A big brother of the TP Forum joined me tonight and said that he also encountered this problem! Think about the fact that many things have been encountered.

DEMO code that uses cached APC on the same server is more efficient than Memcached

apc

Copy codeThe Code is as follows:$ Memcachehost = 'localhost ';$ Memcacheport = '000000 ';Function microtime_float (){List ($ usec, $ sec) = explode ("", microtime ());Return (float) $ usec + (float) $ sec );}Function runtime ($ t1 ){Return

GBK page outputs php functions in JSON format

Copy codeThe Code is as follows:Function tb_json_encode ($ value, $ options = 0){Return json_encode (tb_json_convert_encoding ($ value, "GBK", "UTF-8 ″));}Function tb_json_decode ($ str, $ assoc = false, $ depth = 512){Return

How to import excel Data to the mssql database in Linux

First, clear your ideas. First ,~~First, you need to upload the file to the server.Then: Read the excel Data column and display itThen, let the user select the corresponding field relationship.Then: submit the data and read the correspondence

Total Pages: 12780 1 .... 12711 12712 12713 12714 12715 .... 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.