Often have friends with PHP socket application is full of doubt, this article on the example code to make a explanation, hope to beginners PHP friends play a little help role
The specific code is as follows:
1. Server-side code:
$name = $val;
1.array_merge () Merge
Example
$array = Array (' A ' => ' BB ');
$array 2 = Array (' B ' => ' cc ');
$array 3 = Array_merge ($array, $array 2);
Output is
Array ([a] => BB [b] => cc)
It's all right because it's all arrays, and if we're
PHP and JavaScript are beginners. There is a need recently:
For example, there is a multiple-line PHP string:
$a =
When passed to JavaScript, it is equivalent to:
var c= ' thy38\n\
csdn\n\
blog ';
Because the
The Strstr () function searches for a string that appears for the first time in another string. The function returns the remainder of the string (from a match point). returns false if the searched string is not found.
Syntax: Strstr (String,search)
Dispatch is a small PHP framework. It does not give you complete MVC settings, but you can define URL rules and methods to better organize your applications. This is perfect for APIs, simple sites, or prototypes.
Copy Code code as follows:
Let's check our PHP first to see if we've opened the GD library.
Copy Code code as follows:
if (extension_loaded (' GD ')) {
Echo ' You can use gd ';
foreach (Gd_info () as $cate => $value)
echo "$cate: $value ";
}else
Echo
In the PB development process, because the database uses the ntext field, the following prompts the error, depressed for a long time can not find the solution, after consulting a large number of data, finally understand:PB Error: You cannot use
Session data exposureSession data often contains personal information and other sensitive data. For this reason, the exposure of session data is a matter of general concern. Generally speaking, the scope of exposure is not very large, because
The header () function sends the original HTTP header to the client.
Copy Code code as follows:
200 normal state
Header (' http/1.1 OK ');
301 permanent Redirect, remember to add a redirect to the following address Location: $url
First, embed PHP code in javascript
JavaScript is included in the JS file, then the JS file can also write directly PHP code, but contains a JS file is the extension to be converted to PHP, such as:
Copy Code code as follows:
Default
Policy pattern: Defines a series of algorithms that encapsulate each algorithm and allow them to be replaced by each other. This mode allows the algorithm to vary independently from the customer who uses it. The policy pattern distinguishes the
Cjuidatepicker is used for date input, which encapsulates the JUI DatePicker plug-in, and its basic usage is as follows:
errorsummary ($model);?>
widget (' Zii.widgets.jui.CJuiDatePicker ', Array (
' name ' => ' my_date ',
' language ' => '
Using PHP to control the user's browser--ob_* series functions
The output control function gives you a free rein in the outputs of the data in the script. It's very useful, especially for: when you want to output the file header after the data has
On the day of query by php and mysql, this week is queried, and the data instance of this month is queried (the field is a timestamp ).
On the day of query by php and mysql, this week is queried to query the data instance of this month (the field is
PHP converts the uppercase and lowercase letters of a string to an instance.
The first letter of each word is converted to uppercase:Ucwords ()
The first letter of a word is capitalized:Ucfirst ()
The first letter of a word becomes
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