Home > Backend Development > PHP Tutorial > 用双引号赋值的字符串中,是不能包含数组变量吗?该怎么解决

用双引号赋值的字符串中,是不能包含数组变量吗?该怎么解决

WBOY
Release: 2016-06-13 10:27:28
Original
1115 people have browsed it

用双引号赋值的字符串中,是不能包含数组变量吗???
我有个语句是这么写的:

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$str = "( $value['title'], $value['artiste'], $value['album'], $value['by'], $value['lrc'], $timeStamp, $timeStamp), ";
Copy after login


报错:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

请问像这种在双引号里使用数组变量的,必须要拆开写吗?不能这么包含?

谢谢!

------解决方案--------------------
do it like this

PHP code
$str = "( {$value['title']}, {$value['artiste']}, {$value['album']}, {$value['by']}, {$value['lrc']}, $timeStamp, $timeStamp), ";<div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template