We all know PHP GD library can be easily created from the URL of an image, GD has Imagecreatefromjpeg (), Imagecreatefrompng () .... such as function can sometimes read from the URL of the cut BMP image and hateful is GD2 in the cut but no
So I wrote a few lines of code to achieve the above requirements
Execution Result:
Copy CodeThe code is as follows:
$conn =mysql_connect (' localhost ', ' root ', ');
mysql_select_db (' database ', $conn);
$sql = "Select Information_schema.
The following gives the source code of the two versions of the function and the simple test, and finally I will give a more practical function of the string interception. It is important to note that the string interception problem discussed here is
one, not using the proxy server situation:
REMOTE_ADDR = Your IP
Http_via = no value or no display
Http_x_forwarded_for = no value or no display
second, the use of transparent proxy server situation: Transparent Proxies
REMOTE_ADDR = Last Proxy
Copy CodeThe code is as follows:
Class Bar
{
Public Function test () {
$this->testprivate ();
$this->testpublic ();
}
Public Function Testpublic () {
echo "bar::testpublic\n";
}
Private Function Testprivate () {
echo "bar::testprivate\n";
}
}
Class
I wrote a PHP result set into a JSON-formatted function that can be called directly:
Copy CodeThe code is as follows:
function Recordtojson ($recordset)
{
$jstr = ' [';
while ($rs = $recordset->fetch ())
{
$nick = Iconv ("GBK", ' Utf-8 ', $rs ['
The first type of code: less CodeThrough regular expression to obtain the real address of the Baidu network disk file, to achieve the effect of straight chain
Save the following code as downbd.php
Copy CodeThe code is as follows:
$canshu
Copy CodeThe code is as follows:
Header ("content-type:text/html; Charset=utf-8 ");
Define (' App_root ', str_replace (' \ \ ', '/', dirname (__file__)));
$test = ' Here is a Chinese test code! ';
function Get_tags_arr ($title)
{
Require (app_root.
One, array processing function:
The feeling of intoxication: array processing functions are very common in PHP development, and it is important to learn good array processing functions. Array processing functions are involved in practical
1. Factory mode
The main function is to reduce the coupling degree.
Copy CodeThe code is as follows:
Abstract class operation{
Abstract public Function GetValue ($num 1, $num 2);
Public Function getAttr () {
return 1;
}
}
Class Add extends
3 ways to generate XML files in PHP compare speed
There are 3 ways to write directly; use DOMDocument; use simplexml;
In fact, there is a 4th kind: use XmlWriter, but I have not used, also too lazy to try.
The main reason is to look at these 3 ways,
Starting with version 5.2, PHP native provides the Json_encode () and Json_decode () functions, which are used for encoding, which is used for decoding.
First, Json_encode ()This function is primarily used to convert arrays and objects into JSON
Solution One (thinkphp officially provided, I have not tested): upgrade to ThinkPHP3.1 the latest UploadFile.class.php (https://github.com/liu21st/ extend/tree/master/extend/library/org/net), replace the original UploadFile.class.php after
In this paper, we will explore two specific implementation methods, and do a simple performance comparison of different methods.
1. Classic curl concurrency mechanism and its existing problemsThe classic Curl implementation mechanism is easy to
But how do you traverse the two-tree array generated by this method? Here's my approach:
Copy CodeThe code is as follows:
function Pretree ($cat) {
foreach ($cat as $c) {
?>
">
:
">
:
if (Isset ($s ['
Nonsense not much to say directly on the code.
PHP for Smarty
Copy CodeThe code is as follows:
* Name:time_ago
* Purpose: The timestamp is designed to be a representation of the current time
* Within 1 minutes by seconds
* Display in minutes within
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