This article introduces php functions ob_start (), ob_end_clean (), and ob_get_contents (). If you need them, refer to them.
Usage of the following three functions
Ob_get_contents ()-return the content of the output buffer
Ob_get_contents
(PHP 4,
For details about the differences between php mysql_escape_string and addslashes, refer to this article.
The mysql_real_escape_string () function escapes special characters in strings used in SQL statements.
The following characters are affected:
This article summarizes the usage of php display_errors and log_errors. For more information, see this article.
Display_errors
Error ECHO, which is commonly used in development mode. However, many applications forget to disable this option in the
Php randomly extracts some element code from the array for your reference.
The Code is as follows:
Copy code
Class getValues {Public function inputValue ($ inputArray ){$ This-> inputArray = $ inputArray;}Public function
The setcookie () function is a function in php used to set the cookie value. Next I will summarize the specific usage of the setcookie () function and how to obtain the cookie value after setting.
The setcookie () function sends an HTTP cookie to
To achieve this purpose, you must ensure that only one instance exists in the project and provide an access point for global access. In this case, you need to call a shared static method of this class to access this instance. That is to say, this
In php, there are many functions that can be used to traverse arrays, such as the for statement, list, each, and foreach functions. These are also the main functions used to traverse arrays in php, next I will introduce it to you.
Foreach traversal
Using php to verify the date format, we can use the checkdate () function and regular expression to verify the format. Next I will introduce some of my processes in verifying the date format, finally, the simplest method is obtained.
1. Use regular
When you open phpmyadmin today, the system prompts: phpMyAdmin cannot load the mcrypt extension. Check the PHP configuration. Let's take a look at the solution to the failure to load mcrypt.
When you open phpmyadmin, you will be prompted that the
Many users may find that their ecshop often times out when it is used. There are many solutions to this problem. We can directly modify it in ecsho. The specific method is as follows:
Modify it in includescls_session.php
The Code is as
Today, I learned why PHP generates CSV files and garbled characters when opened in Excel. The following section describes some common methods. I hope this method will be helpful to all of you.
Baidu found out
PHP generate UTF-8 encoded CSV file with
The Curl function is not enabled by default in php. If you need to use Curl, remove the extension = php_curl.dll in php. ini.
I first removed the extension = php_curl.dll in php. ini and restarted the apache environment, but the following function
I have previously told you how to generate multiple random numbers. Next I will introduce how to generate N non-repeated random number instances in php. If you are interested, refer to it.
It is not difficult to implement this function, but I have
Mysql and information_schema databases on the mysql server are System databases, which is of little use to us, but they cannot be deleted, so how can we hide mysql and information_schema databases? Let's take a look at how to hide them.
Content
Next, I would like to recommend you to use php recursive traversal to traverse all files and sub-file instance code in the folder. I hope this will help you.
Write a function to traverse all files and subfolders in a folder.
The Code is as
If we need to hide the download file path, we only need to enter it directly, without the need to jump to the path. Let's take a look at an instance and hope it will help you.
The Code is as follows:
Copy code
// Set the
Php tutorial how to create a high-definition thumbnail
1. Use imagecreatetruecolor and imagecopyresampled functions to replace imagecreate and imagecopyresized2. Add 100 to the third parameter of imagejpeg (for example, imagejpeg ($ ni, $ tofile, 100
When you connect to SQL Server, SQL Server Driver for PHP supports SQL Server Authentication. When using SQL Server authentication to connect to SQL Server, you must consider the following:
You must enable SQL Server Hybrid Authentication on the
This article describes how to use php's ase64_encode and urlencode to encrypt strings. It is also a common method. If you need it, please refer to this article.
Base64_decodeDecodes a BASE64 encoded string.
Syntax: string base64_decode (string
This article introduces the usage of the most basic loop statements, including the for (), while (), and foreach () do while statements in php.
While LoopWhile loop is the simplest loop in PHP. Its basic format is:
The Code is as follows:
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