doufang3001 2016-09-27 05:28
浏览 66
已采纳

如何将包含HTML标签和php变量的字符串转换为php字符串变量?

Suppose I have a string as

    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); ?>

How can I put this whole string into a php variable so that all the php variables are converted into their respective values?

  • 写回答

2条回答 默认 最新

  • duanqun9740 2016-09-27 05:46
    关注

    You should try this,

    <?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条)

报告相同问题?

悬赏问题

  • ¥15 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的
  • ¥15 全志H618ROM新增分区
  • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
  • ¥15 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符