Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在php文件中如何使用html引号?_Php_Html - Fatal编程技术网

在php文件中如何使用html引号?

在php文件中如何使用html引号?,php,html,Php,Html,我有这个html: <button type="button" class="btn-option delete po" data-toggle="popover" data-placement="left" data-content="<a class='btn btn-danger po-delete ajax-silent' href='#'>Yes im sure</a><button class='btn po-close'>No</bu

我有这个html:

<button type="button" class="btn-option delete po" data-toggle="popover" data-placement="left" data-content="<a class='btn btn-danger po-delete ajax-silent' href='#'>Yes im sure</a><button class='btn po-close'>No</button> 
<input type='hidden' name='td-id' class='id' value='id'>" data-original-title="<b>Really delete</b>"><i class="fa fa-times"></i></button><a href="url" class="btn-option" data-toggle="mainmodal"><i class="fa fa-cog"></i></a>
<button type="button" class="btn-option delete po" data-toggle="popover" data-placement="left" data-content="<a class='btn btn-danger po-delete ajax-silent' href='#'>Yes im sure</a><button class='btn po-close'>No</button> 
<input type='hidden' name='td-id' class='id' value='id'>" data-original-title="<b>Really delete</b>"><i class="fa fa-times"></i></button><a href="url" class="btn-option" data-toggle="mainmodal"><i class="fa fa-cog"></i></a>

我想把它打印在php文件上,类似这样:

$a=数组(); $a[“按钮”]=“此处为html”

但是单引号打断了我的代码

在这种情况下我怎么做


谢谢

您可以使用PHP的连接运算符(
)对它们进行连接:

$a[“按钮”]=
'

您也可以尝试以下其他方法:

<?php 
$a_tag = "<a class='btn btn-danger po-delete ajax-silent' href='#'>Yes im sure</a><button class='btn po-close'>No</button> <input type='hidden' name='td-id' class='id' value='id'>";
$a['button'] = '<button type="button" class="btn-option delete po" data-toggle="popover" data-placement="left" data-content="'.$a_tag.'" data-original-title="<b>Really delete</b>"><i class="fa fa-times"></i></button><a href="url" class="btn-option" data-toggle="mainmodal"><i class="fa fa-cog"></i></a>';
?>

我希望这能奏效

<?php
$a = array(); 
$a["button"] = "<button type='button' class='btn-option delete po delete ajax' data-toggle='popover' data-placement='left' >Yes sure</button>";
echo $a["button"];
?>
<?php 
$a_tag = "<a class='btn btn-danger po-delete ajax-silent' href='#'>Yes im sure</a><button class='btn po-close'>No</button> <input type='hidden' name='td-id' class='id' value='id'>";
$a['button'] = '<button type="button" class="btn-option delete po" data-toggle="popover" data-placement="left" data-content="'.$a_tag.'" data-original-title="<b>Really delete</b>"><i class="fa fa-times"></i></button><a href="url" class="btn-option" data-toggle="mainmodal"><i class="fa fa-cog"></i></a>';
?>