» » PHP

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

Conversion between PHP array and XML

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

2 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: 677

6 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

 

Use PHP to paginate long articles

Author: bamboo06 on 6-10-2016, 12:28, views: 428

0 When the article content expertise, in order to facilitate reading and page display content we usually paged to display. The general page processing is published in the background when the article will be submitted to generate multiple pages after the static file. In this paper, we will use examples to explain the dynamic use of PHP long page content paging.

Manual paging: the general content in the edit when adding special paging tags, such as {pages}, submitted, the PHP program will process page breaks according to the page break, generate a different static pages. This sort of paging method is accurate, but need to manually add page breaks, a heavy workload.
Automatic paging: PHP program will be set according to the page break the content of the page, and then generate a different static pages. The method is efficient and requires a high tag for handling different html tags.

Category: PHP Scripts

 

Use PHP to prevent duplicate submiting form

Author: bamboo06 on 23-06-2016, 00:26, views: 891

3 We submit the form, a limit can not be ignored is to prevent users who repeatedly submit the form, because there may be a user continuously hits the submit button or a malicious attacker to submit the data, then we submit the data after processing, such as modifying or adding data to the database when they will get into trouble.
Use PHP to prevent duplicate submiting form

So how do you avoid duplicate submission form this phenomenon happen? We can see from many aspects, first from the front end to make restrictions. In the front-end javascript is disabled after a button is clicked, the disabled, this simple method of preventing multiple clicks the submit button, but the disadvantage is that if the user has disabled javascript script is invalid. Second, we can do after submitting the redirect page redirection, that is submitted after the jump to a new page, the main F5 avoid duplicate submissions, but there are drawbacks. Thirdly, it is made unique database index constraint. Fourth, it is to do the session token authentication.

Category: PHP Scripts

 

Use PHP to serialize data and JSON to formate data

Author: bamboo06 on 16-02-2016, 23:52, views: 692

2 PHP's serialize a sequence of the variable, the variable type and returns a string expression with a structure, but JSON is a lighter, more user-friendly format for interfaces (AJAX, REST, etc.) for data exchange. In fact, both are in a string manner to reflect a data structure. So what difference does it have between them?
Use PHP to serialize data and JSON to formate data

We may see the contents of a database or stored in a text file with a long list of seemingly has a special meaning in the text string some old WEB system. We look carefully will find that it has a data type and structure information, but it is not easy to read manual, it is only suitable PHP program reads. PHP's serialize the array is serialized and stored. We assume that there is such an array:

Category: PHP Scripts / Javascript

 

Use PHP to achieve red envelopes

Author: bamboo06 on 29-12-2015, 00:43, views: 583

10 Use PHP to achieve distributing red envelopes, and when we enter the number and total amount, PHP will be randomly assigned to each of these two values based on the amount, to ensure that everyone can receive a red envelope, it is to ask the various amount of red envelope, all of the total amount should be equal to the total amount of red envelopes.
Use PHP to achieve red envelopes

We first have to analyze the law.

Category: PHP Scripts / Javascript

 

POST data reception mode in PHP

Author: bamboo06 on 8-08-2015, 01:42, views: 880

1 Typically the user to use the browser web form to submit data to the server post, we use PHP receiving user data POST to the server, and appropriate treatment. But in some cases, such as the user using the client software to send data to the server-side post php program, rather than using $ _POST to identify, then how should we handle it?
POST data reception mode in PHP

$ _POST Is an array variable is passed by way of HTTP POST method consisting of automatic global variable. Such as using $ _POST ['name'] you can receive a web form and web data asynchronously over the post, namely $ _POST can only receive a document type Content-Type: application / data x-www-form-urlencoded submitted.

Category: PHP Scripts

 

Use HTML5 + PHP + jQuery to change clothes by shaking your phone

Author: bamboo06 on 9-04-2015, 23:59, views: 2268

1 In the previous article, we use HTML5 to listen to the phone in order to achieve a shaking effect. Shake the phone can be applied to many scenarios, such as a shake to change the draw, shake songs, search. In this paper, I will tell you how to use HTML5 + PHP + jQuery to achieve the effect of mobile phone shaking to change clothes.
Use HTML5 + PHP + jQuery to  change clothes by shaking your phone

Category: PHP Scripts / Javascript / Mobile / HTML5

 

use jQuery + PHP to realize dynamic digital display of results

Author: bamboo06 on 28-12-2014, 01:45, views: 888

1 We need a dynamic display of data in some applications, such as the current line number, the current transaction total, at current exchange rates, etc., need real-time refresh the front page for the latest data. This article will tell you with examples using jQuery and PHP to achieve dynamic digital display effect.
use jQuery + PHP to realize dynamic digital display of results

Category: PHP Scripts / Javascript

 

PHP Session and Cookie operation

Author: bamboo06 on 20-12-2014, 02:58, views: 818

1 We need to use to track user information Session and Cookie, such as user login authentication, user browsing history record store shopping cart data, user session valid time limit. Today we come to understand how to operate under PHP is the Session and Cookie.
PHP Session and Cookie operation

PHP's $ _SESSION current user data can be stored, when the user visits WEB site, PHP will give users access to each create a session ID, the ID is a unique ID, saved on the client, and the user's session data is saved to the the service side, PHP can be stored for each different user information when the session expires, the user session information will be invalidated.

Category: PHP Scripts

 
Previous Next