» » PHP

 
Sort articles by: Date | Most Rates | Most Views | Comments | Alphabet

PHP and UTF-8

Author: bamboo06 on 14-08-2019, 18:43, views: 3023

0 When working with the Unicode character set, use the corresponding function instead of the native string function. For example, if a file is encoded as UTF-8 PHP code, if the strlen() function is wrong, use the mb_strlen() function instead.
PHP and UTF-8

If you use substr to intercept Chinese characters, garbled characters will appear, because substr is intercepted in bytes. That is, UTF-8 encoded Chinese, using substr interception, will only intercept 1/3 Chinese, of course, garbled. When UTF-8 is encoded, a Chinese character is 3 bytes. Similarly, different languages in other countries will produce multi-byte strings, so we use mb_strlen() to handle them.

Category: PHP Scripts

 

PHP security data filtering and verification

Author: bamboo06 on 28-07-2019, 18:26, views: 1536

0 Never trust external input, don't trust any data from a data source that is not under your direct control. In actual development, there is always someone intentionally or unintentionally injecting dangerous data into PHP code, so PHP security programming becomes important. Generally, we deal with external input security ideas: filtering input and verifying data.
PHP security data filtering and verification

Filtering input means escaping or deleting characters that are not safe from external data.

Category: PHP Scripts

 

PHP+Crontab performs scheduled tasks

Author: bamboo06 on 28-07-2019, 18:16, views: 1287

0 When we do web project development, we often need to periodically back up data, periodically restart a service or periodically execute a PHP program, etc., generally use Crontab under Linux and use scheduled tasks under Windows. This article focuses on the basics of using Crontab under Linux and performing PHP tasks.
PHP+Crontab performs scheduled tasks

Crontab is a commonly used timing execution tool for Unix/Linux systems that runs specified jobs without human intervention.

Category: PHP Scripts

 

PHP+Crontab performs scheduled tasks

Author: bamboo06 on 21-04-2019, 02:03, views: 1695

0 When we do web project development, we often need to periodically back up data, periodically restart a service or periodically execute a PHP program, etc., generally use Crontab under Linux and use scheduled tasks under Windows. This article focuses on the basics of using Crontab under Linux and performing PHP tasks.
PHP+Crontab performs scheduled tasks

Crontab is a commonly used timing execution tool for Unix/Linux systems that runs specified jobs without human intervention.

Category: PHP Scripts / Apps

 

PHP PSR-3 Log Interface Specification

Author: bamboo06 on 2-02-2019, 17:34, views: 2558

0 The main purpose of this specification is to allow the log class library to log information in a simple and generic way by receiving a PsrLogLoggerInterface object. The framework and the CMS content management system can extend this interface if necessary, but this specification is required to ensure that the log interface can still be properly connected when using third-party class library files. This article develops a generic interface specification for the log class library.
PHP PSR-3 Log Interface Specification

The implementers in this article refer to the class libraries or frameworks that implement the LoggerInterface interface. Conversely, they are the users of LoggerInterface.

Category: PHP Scripts

 

PHP PSR-2 code style specification

Author: bamboo06 on 2-02-2019, 17:26, views: 1450

0 This specification is an inheritance and extension of the PSR-1 basic code specification. This specification hopes to reduce the inconvenience caused by the different styles of the code when browsing the code of different authors by formulating a series of rules for normalizing PHP code.
PHP PSR-2 code style specification

When multiple programmers work together on multiple projects, a common coding specification is needed. The style specification in this article is derived from the common characteristics of multiple different project code styles. Therefore, the value of this specification is that we all follow This coding style is not about itself.

Category: PHP Scripts

 

PHP PSR-1 basic code specification

Author: bamboo06 on 2-02-2019, 17:06, views: 1553

0 Encoding specifications and standards are extremely important when working with groups to develop PHP projects. Next, let's revisit the PHP code related specifications developed by the FIG organization. The current general specifications are: PSR-1 basic code specification, PSR-2 code style specification, PSR-3 log interface specification, PSR-4 Autoloader automatic loading specification.
PHP PSR-1 basic code specification

The PSR-1 Basic Code Specification establishes standards for the basic elements of the code to ensure a high degree of interoperability between shared PHP code.

Category: PHP Scripts

 

Monolog-PHP log class library introduction

Author: bamboo06 on 2-12-2018, 17:47, views: 2106

0 Monolog is a full and easy to expand log log library under php. There are many well-known php frameworks including Symfony, Laravel, CakePHP and so on that have Monolog built in. Monolog can send your logs to files, sockets, inboxes, databases and various web services.
Monolog-PHP log class library introduction

Monolog follows the PSR3 interface specification and can be easily replaced with other log classes that follow the same specification. Monolog has good extensibility. Through the interfaces Handler, Formatter and Processor, you can expand and customize the Monolog library.

Category: PHP Scripts / Plugins

 

Conversion between PHP array and XML

Author: bamboo06 on 9-04-2017, 00:59, views: 17973

0 In the development, we often encounter the conversion between the array and XML, especially when dealing with interface development often used, such as the other side of the client POST a XML format data to the server, the server program is responsible for receiving Analysis, there is a need to data table data in XML format to provide third-party applications.
Conversion between PHP array and XML

Category: PHP Scripts

 

Use PHP to generate short URLs

Author: bamboo06 on 9-04-2017, 00:40, views: 128498

0 The normal site to bring the kind of parameters may be very long, especially in the printing of paper products such as corporate brochures to be printed on a long url, then very ugly, and few people will go to remember this site, Although it is now possible to use a two-dimensional code to open a long URL. But people can use short URLs to achieve beautiful links, especially those with limited number of applications such as microblogging.
Use PHP to generate short URLs

Short URL implementation principle is that there is a data table configuration file will be short URL and the actual URL corresponding, when a short URL request, the program jump to the corresponding actual URL up, in order to achieve the URL of the visit.

Category: PHP Scripts / Plugins

 
Previous Next