假设我有一个字符串
Hi, <br><br>
Someone has shared a <?php echo $job_type ?> with you through <?php echo CHtml::link(Yii::params['Data_Port'], Yii::app()->getBaseUrl(true)); ?>.<br><br>
Title: <?php echo $job_title;?><br><br>
<?php echo CHtml::link("View"." ".ucfirst($job_type)." "."Details", $job_link); ?>
如何将整个字符串放入php变量中,以便将所有php变量转换为各自的值?
答案 0 :(得分:2)
你应该试试这个,
<?php
$str='';
$str.="Hi, <br><br> Someone has shared a ";
$str.=$job_type;
$str."with you through";
$str.=CHtml::link(Yii::params['Data_Ports'], Yii::app()->getBaseUrl(true));
$str.="<br><br>";
$str.="Title:";
$str.=CHtml::link("View"." ".ucfirst($job_type)." "."Details", $job_link);
?>
答案 1 :(得分:0)
您可以使用htmlentities
转换字符串,使用html_entity_decode
解码该字符串。希望这会对你有所帮助。