1. Remove all HTML elements, or keep a few HTML tags
Copy Code code as follows:
$text = ' test paragraph. other text ';
echo Strip_tags ($text);
echo "/n";
Allow and Echo strip_tags ($text, ' ');?>
The result is (minus
1. Create a php file, PHP code is as follows
PHP code saved to desktop, set to desktop
Create a new file desktopurl.php code as follows:
Copy Code code as follows:
.
Save for desktopurl.php, or you like to call him what name,
PHP data type
PHP supports eight original types (type).
Four scalar types:
String (strings)
Integer (integral type)
Float (floating-point type, also double)
Boolean (Boolean)
Two types of composite:
Array (arrays)
Object (Objects)
Two special
We write programs, will inevitably have problems (is often encountered problems), and PHP encountered errors, it will give the location of the error script, line number and reason. A lot of people say it's not a big deal. Indeed, in the debugger
0X01: Test PDO whether the installation was successful
Run the following code, if you are prompted for a parameter error, PDO has been installed, if the description object does not exist, modify the PHP configuration file php.ini, cancel
Nonsense not much to say, directly on the code.
Copy Code code as follows:
Set time zone
Date_default_timezone_set (' Asia/shanghai ');
/**
* Seconds turn time, format month day time seconds
*
* @author wangyupeng129@126.com
*
Last week at work, I encountered the code to process a section of pagination! It used to be written very skilled, may be lazy too long! It's almost forgotten.
Some knowledge is too long do not have to forget quickly ah! So it is important to review
If the string is enclosed in double quotes, PHP resolves some special characters in the string.
Example 1:
$i = 80;
$a = "hello$i";
$b = ' hello$i ';
Echo ' $a = '. $a; Output $a=hello80, double quote output variable value
Echo ' $b = '. $b;
Recently encountered a problem, is the indefinite dimension array of empty values removed, back to study, write out, do not know whether or not to optimizeWrite bad, if there is a good idea or a good way to achieve, welcome to come, if there is
In the morning to see so a question about PHP, the questioner describes an array, using PRINT_R can see the index key and the corresponding value is present, but access to the element, whether using Array[key] or array[' key ', the two Access forms,
Use iframe to refresh the uploaded file
The file upload function is often used on the page, and the page is not refreshed. Let's talk about the principle first: put a file control and the submit button in the page and wrap it with a form outside,
PHP form verification (1), php form verification
PHP VerificationStep 1: first obtain the content transmitted from the form; $ _ POST ['']; // use this function to obtain the data of the form,
POST must be capitalized, and the brackets must contain
Php obtains gender and birthdate from the ID card, and php gender Birthdate
For more information, see the code:
// Query the Gender and birthday by ID card number $ birth = strlen ($ idcard) = 15? ('19 '. substr ($ idcard, 6, 6): substr ($ idcard,
How to open the php gd2 Library and the phpgd2 Library
Step 1: Find php. ini
Generally, this file is in the php installation directory. If you forget the path, you can query it on the web service software you are using.
Step 2: open the file in
Example of how PHP implements multi-level classification Spanning Tree, php example
This example describes how PHP implements a multi-level classification spanning tree. We will share this with you for your reference. The details are as
Php Character Set conversion, php Character Set
PHP uses iconv to convert a string from gbk to the UTF8 character set.
1. iconv () Introduction
The iconv function can convert a known character set file to another known character set file. Example:
Describes how yii2 implements database/table sharding.
Preface
You can start code tracing from any gii generation model class, and you will find that the model layer of yii2 implements DAO access to the database based on ActiveRecord.
The
PHP5.5 install PHPRedis extension and connection test method, php5.5phpredis
This document describes how to install PHPRedis extension and test the connection in PHP5.5. We will share this with you for your reference. The details are as
Super multi-function php green integrated environment, 700 PHP versions can be switched at any time, multi-function 700
Many people have heard of the word WAMP. First, let's look at what it means?
In Windows, Apache + MySQL + PHP is called WAMP.
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