Parsing php uses regular expressions to solve the problem of collecting content Layout

The problem that is often encountered during collection is the problem of content formatting. After some time, I wrote a function that replaces html tags and styles with regular expressions, sharing them.Copy codeThe Code is as follows:/*** Format

Use PHP to find the relative path of the two files

Copy codeThe Code is as follows:Function compare ($ ph1, $ ph2 ){$ Ret = '';$ _ F1Arr = explode ("/", $ ph1 );$ _ F2Arr = explode ("/", $ ph2 );$ F1 = array_pop ($ _ f1Arr );$ F2 = array_pop ($ _ f2Arr );For ($ I = 0; $ I If ($ _ f1Arr [$ I]! ==$ _

PHP implementation code for loop deletion of Infinitely classified subnodes

Copy codeThe Code is as follows:Private function _ deleteSubNode ($ ids ){ $ SubNodes = array ();$ Mod = D ('node ');Foreach (explode (',', $ ids) as $ k ){$ Res = $ this-> _ getSubNode ($ k, $ subNodes [$ k], $ mod); // obtain the subnodeIf (!

Use preg_replace dangerous/e modifiers with caution (one-sentence backdoor is commonly used)

Preg_replace function prototype: Mixed preg_replace (mixed pattern, mixed replacement, mixed subject [, int limit])Note: The/e modifier enables preg_replace () to treat the replacement parameter as PHP code (after appropriate reverse references are

The encapsulation method cannot be used when thinkphp is connected to oracle

Recently I collected some questions about how THinkPHP connects to the Oracle database. Many of my friends follow the mysql connection method, which causes some methods to be unavailable in Oreale. For example, the findAll and Select methods cannot

Analysis on php header redirection

PHP header functions can implement META tags in HTML code with little codeHere we only use the header function for page Jump. 1. page Jump code in HTML codeHTML meta refresh and redirect pageRefresh property value-refresh and redirect page* Refresh

In-depth analysis of differences between php include and require

Nclude ()The include () statement includes and runs The specified file.The following documents also apply to require (). These two structures are identical except for how to handle failures. Include () generates a warning and require () causes a

MySql Data Query by time period (instance description)

The time format is 2008-06-16.Query the data of the current day:SELECT * FROM 'table' WHERE date (time field) = curdate ();Query the current month field:SELECT *FROM 'table'WHERE month (time field) = month (now ());The time format is 1219876 ......

What is phpDocumentor page 1/2

1. What is phpbench entor?PHPDocumentor is a tool written in PHP. For php programs with standardized annotations, it can quickly generate API documents with functions such as mutual reference and indexing. The old version is phpdoc. It was renamed

Function for deleting HTML tags in strings in php

When a visitor leaves a message or post a message, we do not want the visitor to use html tags in the message or post. Therefore, when the visitor submits a message or post, I have to delete the html Tag, the following function is used to implement

How to solve the garbled problem caused by php + AJAX transmission of Chinese Characters

// If the transfer parameter is directly assigned, garbled characters are generated!Copy codeThe Code is as follows:Http_request.open ("POST", url, true );Http_request.setRequestHeader ('content-type', 'application/x-www-form-urlencoded

Php online package source code

Package Functions ~ Easy and convenient! Although the compression ratio is a little worse than winrar, it does not matter. After all, it is only packaged for download.It saves you the trouble to package your site on the server. If the server is not

If you are recommended to learn php sesson, you must check PHP Session 1/2.

The Session is stored on the server as a text file, so the client is not afraid to modify the Session content. In fact, in the Session file on the server side, PHP automatically modifies the Session file permissions, only retaining the system read

Function for filtering dangerous html code using php

# Html published by the user to filter dangerous codeFunction uh ($ str){$ Farr = array ("// \ S +/", // filter unnecessary Spaces"/] *?)> /IsU ", // filter the code that may introduce malicious content or maliciously change the display layout. If

A simple example of AJAX combined with PHP code to achieve login effect code

HTML section: Function postRequest (strURL ){Var xmlHttp;If (window. XMLHttpRequest) {// For Mozilla, Safari ,...Var xmlHttp = new XMLHttpRequest ();}Else if (window. ActiveXObject) {// For Internet ExplorerVar xmlHttp = new ActiveXObject

Parameters for connecting to MySQL code using PHP

The Code is as follows:$ Link = mysql_connect ("localhost", "root", "123456 ");If (! $ Link) echo "no connection successful! ";Else echo "connection successful! ";?>The red part can be modified based on your actual situation.Localhost: indicates the

Bad Wolf php learning counter instance code

Create a file as follows. Connect to the database in step 1st, write the file, and then read it.Copy codeThe Code is as follows:$ Mysql_server_name = "localhost ";$ Mysql_username = "root ";$ Mysql_password = "";$ Mysql_database = "db ";// Capture

Ajax PHP simple getting started tutorial code

First, we will learn how to create this object in javascr sans pt:Var xmlHttp = new XMLHttpRequest ();This line of simple code creates the XMLHttpRequest object in Mozilla, Firefox, Safari, Opera, and basically all non-Microsoft browsers that

PHP class used to add watermarks to images

Copy codeThe Code is as follows:/** Function: PHP image watermark (watermarks support images or text)* Parameters:* $ GroundImage: Specifies the background image to be watermark. Currently, only GIF, JPG, and PNG formats are supported;* $ WaterPos

Php access operations

Copy codeThe Code is as follows:--------------------------------------------------------------------// FileName: class. php// Summary: Access database operation class// Author: forest// CreateTime: 2006-8-10// LastModifed:// Copy right (c) 2006//

Total Pages: 12780 1 .... 12720 12721 12722 12723 12724 .... 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.