PHP string truncation (Chinese truncation) 2. single-byte truncation Mode

// Chinese truncation 2, single-byte truncation Mode Function cn_substr ($ STR, $ slen, $ startdd = 0 ){ $ Restr = ""; $ C = ""; $ Str_len = strlen ($ Str ); If ($ str_len If ($ str_len $ Enddd = $ startdd + $ slen-1; For ($ I = 0; $ I { If ($

[PHP] function 3

// Obtain the current Script URL CopyCode The Code is as follows: function get_php_url (){ If (! Empty ($ _ server ["request_uri"]) { $ Scriptname = $ _ server ["request_uri"]; $ Nowurl = $ scriptname; } Else { $ Scriptname = $ _ server ["php_self"]

PHP implementation code for escape and Unescape functions in JS

Function phpescape ($ Str) { $ Sublen = strlen ($ Str ); $ Retrunstring = ""; For ($ I = 0; $ I { If (ord ($ STR [$ I]) >= 127) { $ Tmpstring = bin2hex (iconv ("gb2312", "ucs-2", substr ($ STR, $ I, 2 ))); // $ Tmpstring = substr ($ tmpstring,).

Instructions on adding the extension = php_mysqli.dll command to PhP. ini

MySQL is used as the database when PhP5 is configured. Many people think that you only need to add the extension = php_mysql.dll; command in PHP. ini. It is unclear why there are many Article We recommend that you also add the extension =

Common functions for processing strings in PHP mixed Chinese and English formatting

# Determine whether a position is the left or right part of a Chinese character or not a Chinese character # Return Value-1 left 0 is not a Chinese character 1 right # Usage /* $ A = 'this is Chinese '; Print is_chinese ($ A, 1); // 0 Print

PHP and SQL injection attacks [1]

Haohappy Http://blog.csdn.net/Haohappy2004 SQL injection attacks are the most common means for hackers to attack websites. If your site does not use strict user input tests, it is very vulnerable to SQL injection attacks. SQL injection attacks

An entry-level PHP class article

I just browsed the updated class-related topic on the homepage. Article (Refers to the http://www.phpe.net/articles/389.shtml of phpe), very good, it is recommended to look. Exploration of classes ~~ It took me half a year to understand the role

PHP Regular Expression Function preg_replace () parameter description

Preg_replace Parses and replaces string comparison. Syntax: Mixed preg_replace (mixed pattern, mixed replacement, mixed subject ); Returned value: hybrid data Function Type: Data Processing Description This function uses the Pattern Rule to

Automatically generate the document summary code [PHP version]

Implementation content: truncate a section containing HTML Code But there is no issue that the containment mark is not closed. Note: This is a PHP version used on the server. If you need a Client Version, read the next article. We are writing a

PHP program for converting data to dedecms

PS: this can be an inverse, such as ASP, such as cloud or Nb. Article The system can be converted to dedecms or other php cms. CopyCode The Code is as follows: // Read MDB data library routine Set_time_limit (0 ); $ Conn = new COM ("ADODB.

Tips for using MVC in PHP

Use of MVC in PHP First, let me give an example: A simple Article Display System In simple cases, we assume that the article system is read-only. That is to say, this example will not involve the publishing of the Article. Now it is started. Since

PHP Chinese Character Verification Code

Replace HB. TTF with the TTF you just downloaded. CopyCode The Code is as follows: Header ("Content-Type: image/PNG "); $ STR = "first, when there is a conflict with everyone, the main person will use work hours for them to make Chinese products.

PHP: How to Write readable code

A successful development team requires every member of the team to follow Code Reuse rules, which push code reusability to the extreme without significantly reducing developers' creativity and development efficiency. If developers who write and use

PHP generates the calendar code

/* Function written by Nelson Neoh @ 3/2004. For those who wants to utilize this code, please do not remove this remark. If you have done any enhancement to this code, please post the copy at http://www.dev-club.com PHP board. Thank you.

PHP framework phpbean description

Phpbean has few core files, which is very relevant to phpbean design ideas (focusing on performance and cooperative development by division of labor. The core of phpbean is only to implement the basic MVC Framework and does not provide any redundant

Code for sending mails via SMTP in PHP

A recent project needs to use SMTP to send emails. The previous library class does not exist, and it is too complicated to install pear or use the net/SMTP class of pear. The core is extracted from discuz and slightly modified. Find the SMTP

How to Use eAccelerator to accelerate PHP code

EAccelerator is really a good thing (its predecessor is truck-mmcache ). Simply put, it is a cache system that works with PHP (supporting PHP5) and exchanges data through shared memory or disk files. It is widely used in PHP source code "encoding" (

Some common php simple command code highlights

Delete: Reference If (file_exists ("file.htm") // check whether this file exists If (file_exists ("chat") // check whether this folder exists Rename ('index. php', 'index'); // rename index. php to index Fopen ("name. php", "a +"); // create a

Pagination in PHP

// Establish a database connection $ Link = mysql_connect ("localhost", "root", "wyh7ye "); ; // Obtain the current page number Mysql_select_db ("test", $ link ); If (isset ($ _ GET [page])... { $ Page = intval ($ _ GET [page]); } Else ...{ $

Use PHP to generate a static HTML library with High Speed

Copy codeCode: ob_start (); # enable server Cache Include_once 'index. php '; $ Ctx = ob_get_contents (); # Get Cache Ob_end_clean (); # Clear the cache $ Fh = fopen ("index.html", "w + "); Fwrite ($ fh, $ ctx); # write html to generate html Fclose (

Total Pages: 12780 1 .... 10316 10317 10318 10319 10320 .... 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.