PHP implements formatting of multi-line text into JS usable format_PHP tutorial
WBOY
Release: 2016-07-13 09:57:10
Original
955 people have browsed it
php implements formatted multi-line text into a usable format for Js
There are many scenarios for storing and writing templates in js, such as: html code templates for pop-up boxes, etc., which are not supported by js The way to write long text with line breaks must be added up line by line, such as:
The code is as follows:
var content = '
row 1
'
'
row 2
';
but cannot be written as:
The code is as follows:
var content = '
row 1
row2
';
So I processed a small piece of php code to simplify the manual typing operation.
http://www.bkjia.com/PHPjc/984498.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/984498.htmlTechArticlephp implements formatted multi-line text into Js usable formats. There are many scenarios for saving and writing templates in js, such as: pop-up html code templates for boxes, etc. js does not support long text writing with line breaks, and one line is required...
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn