[英]syntax error, unexpected double-quote mark PHP
I am creating a class to create targets of type input text but it shows me the error我正在创建一个类来创建输入文本类型的目标,但它向我显示了错误
syntax error, unexpected double-quote mark PHP语法错误,意外的双引号 PHP
<?php
class OBJElementosForm {
function _construct(){
}
function CrearInputText ($Lista,$nombre){
$opcion = "";
foreach ($Lista as $valor)
{
$texto = '<label>'.$valor.'</label>';
$opcion=$texto.'<input type="text" id='".$valor."'name='".$nombre."' value='".$valor."'>
<br>'.$opcion;
}
}
}
?>
This should be okay:这应该没问题:
$opcion=$texto.'<input type="text" id="'.$valor.'" name="'.$nombre.'" value="'.$valor.'">
<br>'.$opcion;
The problem is you've started by a single quote, and used double quotes to close it!问题是你已经从单引号开始,并使用双引号来关闭它! I recommend you to use an IDE or at least a good editor like VSCode to check and reformat your code.我建议您使用 IDE 或至少像 VSCode 这样的优秀编辑器来检查和重新格式化您的代码。
你可以尝试这样的事情:
$opcion=$texto."<input type='text' id='$valor' name='$nombre' value='$valor'><br/>$opcion";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.