First, get the length of the folder that contains the current file, and then use substr to intercept the length:
Copy Code code as follows:
$dirName = Str_replace ("\", "/", DirName (__file__));
$dirNameLength = strlen ($dirName);
Picture Add watermark I believe all friends know, today we look at a section of PHP image add watermark example, I hope the article can help friends.
The above is the entire content of this article, I hope to help you learn, but also
This article describes the PHP simple calendar implementation method. Share to everyone for your reference, specific as follows:
The screenshot of the running effect is as follows:
The specific code is as follows:
Day one two three
This article illustrates the problem of timeout of socket connection and read-write data in PHP. Share to everyone for your reference, specific as follows:
Although the Fsockopen () method in PHP has timeout parameters for connecting sockets, there
This article analyzes the usage of spl_autoload_register () function in PHP. Share to everyone for your reference, specific as follows:
Let's look at another function before you know this function: __autoload.
First, __autoload
This is an auto
Always forget a sentence put in which file, directly all kill ...
Copy Code code as follows:
if (!isset ($dir) or empty ($dir)) {
$dir =str_replace (' \ \ ', '/', dirname (__file__));
echo "". $dir. " ";
} else {
$dir =$_get[' dir ']
So how does the function of this random celebrity quote be achieved?
In fact, it is very simple, only need a string variable, which put all the random to show the famous quotes, and then use the explode function to decompose the number of groups,
Variables: $_server, used in PHP 4.1.0 and later versions. Previous versions, using the $HTTP _server_vars
Variables: $_env, used in PHP 4.1.0 and later versions. Previous versions, using the $HTTP _env_vars
Variables: $_cookie, used in PHP 4.1.0
Copy Code code as follows:
File Header ...
Header ("Content-type:image/png");
Create a true Color white paper
$im = @imagecreatetruecolor (die) or ("Create image Failed");
Get background color
$background _color = imagecolorallocate ($im, 2
By default, the __clone method creates an object that has the same properties and methods as the original object. If you want to change the default content during cloning, you will overwrite (attribute or method) in the __clone.
A cloned method can
You can use->, and if an object's properties contain an object, you can get the properties of the inner object using two-> operators. You can even place these expressions with a string of double references. In the following example, the property
First, the use of related technical keywords: PHP, Apache,
Mod_rewrite (rewritecond,rewriterule) address rewrite,
OB series function buffering
File_put_contents Generate HTML
Second, the process: the user issued a request url?id=x, to determine
The code is very simple, here is not much nonsense, this code to a Netizen's contribution, tested available
$zs 404) {$log = $name.
' *yes '; else {$log = $name.
' No '; File_put_contents ($file _name, $log. Php_eol, File_append); Write
Some time ago said that they encountered a "URL plus error" bug, the reason for this bug is that they use the UrlEncode function in the URL, the function will be converted to a plus space, which causes the URL parsing error, and the space only
Recently looking at Java programming ideas, see the chapter of type information, the information of class and the concept of reflection. By the way warm up PHP reflection. The manual says: "PHP 5 has a complete reflection API that adds the ability
This example for you to share the PHP micro-letter Text message automatically reply code, for your reference, the specific content as follows
1.PHP Sample code DownloadDownload Address 1:http://xiazai.jb51.net/201608/yuanma/phpwx (jb51.net).
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