Direct use of file_get_contents, will be an error;
Copy Code code as follows:
$url = (https://xxx.com ");
File_get_contents ($url);
Error:
Warning:file_get_contents (https://xxx.com) [function.file-get-contents]: failed to
I found a little time on the internet.
Then I thought of a way, it is original.
It's just a function of interception plus substitution.
Copy Code code as follows:
function Smssubstr ($string, $length) {
if (strlen ($string) return $string;
Because this is a language problem, the general scheme is difficult to solve. The following is a scenario that is resolved by using string.
Copy Code code as follows:
$total = 100000;
$double = "";
for ($i = 0; $i {
$double. = Pack ("D",
Recommended functions:
One is PHP to get the current page URL: Dedecms is also used in this
Copy Code code as follows:
Get the current script URL
function Getcururl ()
{
if (!empty ($_server["Request_uri"]))
{
$scriptName =
As a senior and professional Skinner personnel, I began to invest in the great Internet from the beginning to now accumulated a wealth of Skinner experience. I'm sure every web programmer will have a similar experience.
In the Skinner process, it
The use of PHP pseudo static is mainly to hide the passing parameter name, the following to introduce the implementation of the pseudo static PHP method, details please see below.Speaking of pseudo static implementation, you are not very
This article illustrates how PHP implements the method of traversing multidimensional arrays. Share to everyone for your reference, specific as follows:
$a =array (' Fruits ' =>array (' A ' => ' orange ', ' B ' => ' grape ',c=> ' apple '),
'
Want to achieve such a function: Launch a website invitation activity, then the participant (owner) will promote the website address link sends the friend, the friend clicks the link to register successfully after the website, owner's invitation log
The null merge operator is a good thing, and with it we can easily get a parameter and provide a default value if it is empty. For example, in JS can be used | | To engage in:
function Setsomething (a) {
a = a | | ' Some-default-value ';
I use xdebug in the development of the local debugging, but recently joined some projects, the environment is too complex, to build a local development environment is really too much trouble, so how do we use Xdebug to debug remotely?
I use a
1, Directory Inc has the following content:
Sub Directory 0
Sub Directory A
Footer.html
Header.html
login_function.inc.php
mysqli_connect.php
Style.css
2, now PHP to traverse the INC directory, and only display files, do not display directories 0
/**
* Fills a string into a string of a specified length (multibyte security)
* @param string $str Specify the filled strings
* @param int $len Specifies the length of the filled string, not if the value is negative or less than the length of the
Copy Code code as follows:
———————————————————————————–
Function name: Checklengthbetween ($C _char, $I _len1, $I _len2=100)
Role: Determine whether the string within the specified length
Parameters: $C _char (string to be detected)
$I _len1
1. Detect if Apache supports Mod_rewriteView the environment configuration through the Phpinfo () function provided by PHP, and find the "Loaded Modules" through the ctrl+f, which lists all the modules that Apache2handler have opened, and if it
The existing 1.php content is as follows:
Copy Code code as follows:
Echo ' Hi\nhi ';
To execute the file on the command line:
Copy Code code as follows:
Bash >> php 1.php
Hi\nhi
The reason why this cannot be wrapped
Guarantees that a class has only one instance and provides a global access point to access it.The single case pattern has three features:1, a class has only one instance2. It must create this instance on its own3. This example must be provided to
Introduce two methods, first please save the following code as safe.php placed in the site root directory, and then in each PHP file in front of the include ("/safe.php"), you can:
PHP Anti-injection code method one:
Copy Code code as
Pagination page number display algorithm
Copy Code code as follows:
/**
* Get HTML content for pagination
* @param integer $page current page
* @param integer $pages total pages
* @param string $url Jump URL address the last number
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