PHP&;HTML:如何在连接的php字符串变量中包含.php
我正在尝试做的示例:PHP&;HTML:如何在连接的php字符串变量中包含.php,php,html,string,variables,include,Php,Html,String,Variables,Include,我正在尝试做的示例: <?php $html_element = '<form><label>country</label><select>'.include_once("country_list.php").'</select></form>'; ?> 我已尝试了上述方法和以下方法: <?php $html_element = '<form><label>country&
<?php
$html_element = '<form><label>country</label><select>'.include_once("country_list.php").'</select></form>';
?>
我已尝试了上述方法和以下方法:
<?php
$html_element = '<form><label>country</label><select><?php include_once("country_list.php"); ?></select></form>';
?>
如果要包含数据,无论是哪种文件类型,请执行以下操作:
<?php
$html_element = '<form><label>country</label><select>'.file_get_contents("country_list.php").'</select></form>';
?>
感谢您的帮助,事实上它确实起了作用,因此对于这种情况,include\u once()函数是不正确的。country\u list.php中有什么?只是html还是有实际的php需要解析@sage_x10