HTML格式的双引号(PHP)

HTML格式的双引号(PHP),php,html,Php,Html,我有以下代码: <input type="text" name="firstName" id="firstName" value=" <?php setValue( "firstName" ) ?> " /> 问题是,value属性到达第一个引号Try concat: <input type="text" value="' . <?php setValue('firstName') ?> . '"/> 你可以这样用回声 <?php ech

我有以下代码:

<input type="text" name="firstName" id="firstName" value=" <?php setValue( "firstName" ) ?> " />
问题是,value属性到达第一个引号Try concat:

<input type="text" value="' . <?php setValue('firstName') ?> . '"/>

你可以这样用回声

<?php echo  '<input type="text" name="firstName" id="firstName" value="'.  
                 setValue( "firstName" ). '" />' ; ?>

我认为您的数据是通过函数setValue返回firstName值或其他内容。你必须回应你的价值观,那就是

<input type="text" name="firstName" id="firstName" value=" <?php echo setValue( "firstName" ) ?> " />
你的代码是正确的。比使用

<?php echo  '<input type="text" name="firstName" id="firstName" value="'.  
             setValue( "firstName" ). '" />';  ?>

我已经试过了,但它的输出是‘这里有一把小提琴,我认为代码是正确的,应该可以工作。但是,您可以改为使用'。根据下面的答案,您确定您是以.php的形式在php环境(例如)中运行它吗http://localhost 而不是作为文件:///和/或.html文件?我希望你在这里回复评论,而不仅仅是回答。这个函数做什么?设置值。另外,那是JS还是PHP?函数setValue$fieldName{if isset$_POST[$fieldName]{echo$_POST[$fieldName];}}@Fred ii-你说得对,我说了!我用文件://。。。现在,它在函数setValue上显示了一个错误:不能在函数call的结果上使用isset否,这没有work@ShiroiOkami什么意思不工作。。你有一个错误。?。或者该值不是字符串firstname?抱歉,我的意思是该值仅显示“?>”;以某种方式而不是field@ShiroiOkami . 回答错误;位置是的,我也这么认为,但这会输出@ShiroiOkami抱歉,我不理解它显示的字段和里面的值是@ShiroiOkami check。我再次更改了它。我已经检查了,现在它只打印最后的字符“;?>