❮ Tham chiếu chuỗi PHP
Thí dụ
Dải chuỗi từ thẻ HTML:
Hãy tự mình thử »
Định nghĩa và cách sử dụng
Chức năng dải_tags [] dải một chuỗi từ các thẻ HTML, XML và PHP.
Lưu ý: Nhận xét HTML luôn bị tước. Điều này không thể được thay đổi với tham số cho phép. HTML comments are always stripped. This cannot be changed with the allow parameter.
Lưu ý: Hàm này an toàn cho nhị phân. This function is binary-safe.
Cú pháp
Giá trị tham số
sợi dây | Yêu cầu. Chỉ định chuỗi để kiểm tra |
cho phép | Không bắt buộc. Chỉ định thẻ cho phép. Những thẻ này sẽ không bị xóa |
Chi tiết kỹ thuật
Trả về chuỗi tước |
4+ |
Kể từ Php 5.3.4, hàm này bỏ qua các thẻ XHTML tự đóng [như] Trong các tham số cho phép của PHP 5.0, hàm này là an toàn nhị phân. As of PHP 5.0, this function is binary-safe. As of PHP 4.3, HTML comments are always stripped. |
Nhiều ví dụ hơn
Thí dụ
Dải chuỗi từ thẻ HTML, nhưng cho phép các thẻ được sử dụng:
Hãy tự mình thử »
❮ Tham chiếu chuỗi PHP
[Php 4, Php 5, Php 7, Php 8]
Dải_tags - Thẻ HTML và PHP thoát khỏi chuỗi từ một chuỗi — Strip HTML and PHP tags from a string
mariusz.tarnaski tại wp dot pl ¶ ¶
13 năm trước
Hi. I made a function that removes the HTML tags along with their contents:
Result for strip_tags[$text]:
Function:
Sample text:
$text = 'sample text with
sample text with tags
Result for strip_tags_content[$text]:
text with
Result for strip_tags_content[$text, '']:
sample text with
Result for strip_tags_content[$text, '', TRUE];
text with
I hope that someone is useful :]
BZPlan tại Web Dot de ¶ ¶
10 năm trước
a HTML code like this:
with
... the result is:
$str = 'color is bluesize is huge
material is wood';
notice: the words 'blue' and 'size' grow together :[
and line-breaks are still in new string $str
if you need a space between the words [and without line-break]
use my function:
... the result is:
$str = 'color is blue size is huge material is wood';
Function:
1
with
... the result is:
2
with
... the result is:
3
with
... the result is:
with
... the result is:
43 năm trước ¶
CEO tại Carpool2camp Dot org ¶
5
with
... the result is:
6
with
... the result is:
7
with
... the result is:
8
with
... the result is:
9
with
... the result is:
$str = 'color is bluesize is huge
0
material is wood';
$str = 'color is bluesize is huge
1
material is wood';
if[
2Trititaty ¶ ¶
Cesar tại Nixar Dot org ¶
$str = 'color is bluesize is huge
3
material is wood';
16 năm trước ¶
D Mo ¶
$str = 'color is bluesize is huge
4
material is wood';
$str = 'color is bluesize is huge
5
material is wood';
if[
24 năm trước ¶
7 năm trước
$str = 'color is bluesize is huge
7
material is wood';
$str = 'color is bluesize is huge
8
material is wood';
$str = 'color is bluesize is huge
9
material is wood';
notice: the words 'blue' and 'size' grow together :[
0
and line-breaks are still in new string $str
notice: the words 'blue' and 'size' grow together :[
1
and line-breaks are still in new string $str
if[
2Abe ¶ ¶
7 năm trước
notice: the words 'blue' and 'size' grow together :[
3
and line-breaks are still in new string $str
notice: the words 'blue' and 'size' grow together :[
4
and line-breaks are still in new string $str
notice: the words 'blue' and 'size' grow together :[
5
and line-breaks are still in new string $str
notice: the words 'blue' and 'size' grow together :[
6
and line-breaks are still in new string $str
notice: the words 'blue' and 'size' grow together :[
and line-breaks are still in new string $str
7