加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 如何在echo调用中运行函数

发布时间:2020-12-13 17:51:21 所属栏目:PHP教程 来源:网络整理
导读:这是一个快速而简单的问题.我有一个糟糕的一天,不知道如何做到这一点: 我需要做的是…… 我正在检查网址中的PMD,如果这样回应: ?php if ( isset($_GET['pmd']) ) { echo"div class="response"p style="width:350px; height:200px; vertical-align:middl
这是一个快速而简单的问题.我有一个糟糕的一天,不知道如何做到这一点:

我需要做的是……

我正在检查网址中的PMD,如果这样回应:

<?php 
        if ( isset($_GET['pmd']) ) { 
          echo"<div class="response"><p style="width:350px; height:200px; vertical-align:middle;"><strong>Thank you for acting as a &quot;watchman on the walls&quot; of Jerusalem! Your name will now appear on our virtual wall.<br><br>You can also catch up on the latest news from Israel by visiting our news feed below.</strong></p></div>";
        }else { etc...

我需要包含的内容是像触发跟踪像素的图像.

<img src="url.com?cid=12345&aid=1234&oid=<?php echo mt_rand(); ?>&quantity=1" height="1" width="1" />

我想拥有的是:

<?php 
        if ( isset($_GET['pmd']) ) { 
          echo"<div class="response"><p style="width:350px; height:200px; vertical-align:middle;"><strong>Thank you for acting as a &quot;watchman on the walls&quot; of Jerusalem! Your name will now appear on our virtual wall.<br><br>You can also catch up on the latest news from Israel by visiting our news feed below.</strong></p>
          <br />
          <img src="url.com?cid=12345&aid=1234&oid=<?php echo mt_rand(); ?>&quantity=1" height="1" width="1" />
          </div>";
        }else {

要使mt_rand()函数触发,我需要做什么?

谢谢,

马特

您可以使用此语法:
<?php if ( isset($_GET['pmd']) ): ?>
    <div class="response"><p style="width:350px; height:200px; vertical-align:middle;"><strong>Thank you for acting as a &quot;watchman on the walls&quot; of Jerusalem! Your name will now appear on our virtual wall.<br><br>You can also catch up on the latest news from Israel by visiting our news feed below.</strong></p>
      <br />
      <img src="url.com?cid=12345&aid=1234&oid=<?php echo mt_rand(); ?>&quantity=1" height="1" width="1" />
    </div>
<?php else: ?>
    etc
<?php endif; ?>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读