Something written in PHP

Some small things may be useful sometimes!1. Obtain the Client IP address.Function getip (){If (! Empty ($ _ SERVER ["HTTP_X_FORWARDED_FOR"]) {// proxy usage$ Tip = split (",", $ _ SERVER ["HTTP_X_FORWARDED_FOR"]);$ Cip = $ tip [0];}Else$ Cip = $ _

Test static pages with Cache

Function CreateShtml (){Ob_start (array ("callback_CreateShtml", "callback_GoToShtml "));}Function callback_CreateShtml ($ buffer )[{$ Page = intval (@ $ _ REQUEST ["page"]);$ FileName = $ _ SERVER ['document _ root']. dirname ($ _ SERVER ['php _

How to add users to windows using PHP

The method is as follows:Because users are added, the user you run the PHP program must be Administrator and your php. the security mode in ini is not enabled, and the system (), exec (), passthru (), and other functions are not disabled in the

File Upload in PHP

In PHP, file upload is generally implemented through move_uploaded_file.Bool move_uploaded_file (string filename, string destination) This function checks and ensures that the file specified by filename is a valid Upload File (that is, the File

ADODB class usage

MySQL exampleThe most common database in PHP is MySQL, so I think you will like the following program code. It is linked to the MySQL server of localhost. The database name is mydab and runs a SQL select command query, the query results are printed

Install PHP4.0 official version on PWS

1. You can install the Personal Web Server from add-ons \ pws \ setup.exe on the Windows 98 installation disk,Select the typical installation directory C: \ Inetpub \ wwwroot;2. Software

Code for transferring variables between php and javascript

PHP variable to Javascript variable:Copy codeThe Code is as follows: Form variable to Javascript variable:Copy codeThe Code is as follows: PHP variable to Form variable:Copy codeThe Code is as follows: "> // PHP code inside HTML !! Javascript

Two Methods for connecting to sqlserver2000 in php5.3 (com and ODBC)

1. Com link, ADODB. ConnectionCopy codeThe Code is as follows:$ Conn = new Com ("ADODB. Connection"); // instantiate a Connection object$ Connstr = "provider = sqloledb; datasource =.; uid = sa; pwd = 123456; database = jnold ;";$ Conn-> Open ($

VBulletin HACK ---- display the topic size and open a new window on the Forum index page

VBulletin HACK---- Display the topic size and open a new window on the Forum index pageBy gogosoftShow topic sizeCause: this feature is not available in version 1.1.4, and some users use this feature as a reference for viewing topics.Advantage: you

Use php4 to accelerate Network Transmission

Question: Use php4 to accelerate network transmission./***************************************** Title ......: PHP4 HTTP Compression Speeds up the Web** Version ......: 1.10** Author ......: catoc ** Filename...: gzdoc. php** Last changed...: 25/08/2

Disable IE and Firefox cache using php

I found many methods in the network speed, and finally solved the problem.In fact, the simplest way is to add a tag to the header.You can also use Program ControlCopy codeThe Code is as follows:Header ("Cache-control: no-cache, no-store,

Set up the zendframework project environment in windows (through command line configuration)

1. First, make sure that your PHP version is no lower than 5.1.4. However, we strongly recommend that you use 5.2.3 or later. 2. Make sure that the following modules are enabled for your php. ini: Extension = php_pdo.dllExtension =

Functions that extract strings Based on the utf8 Encoding Rules (utf8 sub_str)

Copy codeThe Code is as follows:/** Function: similar to substr, it does not cause garbled characters.* Parameters:* Return value:*/Function utf8_substr ($ str, $ start, $ length = null ){// The screenshot is intercepted normally first.$ Res =

Zend Studio removes the editor's syntax warning setting method

Stage: Zend Studio 8.0 Zend Studio is the preferred development tool for PHP developers. It is equivalent to Visual Studio in Microsoft development tools. The Zend Studio editor can help us identify syntax errors and warnings, but too many warnings

About the PHP autoLoad automatic loading mechanism

_ Autoload usage Method 1: This method is most often used. Find the class file based on the class name, and then require_oneCopy codeThe Code is as follows:Function _ autoload ($ class_name ){$ Path = str_replace ('_', '/', $ class_name

PHP explode () function usage, splitting string

Copy codeThe Code is as follows:// #### Splitting strings ####Function jb51netcut ($ start, $ end, $ file ){$ Content = explode ($ start, $ file );$ Content = explode ($ end, $ content [1]);Return $ content [0];}?>Explode definition and usage The

Php array addition array ("a") + array ("B") result or array ("")

You can see a question on the Internet: The result of array ("a") + array ("B") is ___ A. array ("a", "B ")B. array ("B", "")C. array ("B ")D. array ("") Answer: D Why does the result remain unchanged when the php arrays are added? Because they are

Different descriptions of mysql, mysqli, and PDO

Normal mysql connections will certainly be discarded because every time SQL injection is prevented, it is relatively slow.Mysqli is an optimization made on the basis of common mysql. To be honest, the preprocessing method is successful, which

Comparison of discuz and ecshop truncation string functions in php

The following describes the source code and simple test of the two versions of functions. At last, I will provide a more practical string truncation function. Note: The string truncation issues discussed here are all Chinese strings for UTF-8

Collect PHP knowledge learned during the project

1. You can add restrictions in SQL statements: left (text, 20) only takes the first 20 words of text;2. limit fromRecord and RecordNum can be used as pages. For example, limit indicates that 30 records are traversed from the first record;3. join two

Total Pages: 12780 1 .... 7136 7137 7138 7139 7140 .... 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.