gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 13:08:19 25 4
gpt4 key购买 nike

这是一个快速而简单的问题。我今天过得很糟糕,不知道该怎么做:

我需要做的是这个...

我正在检查 url 中的 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; ?>

关于php - 如何在 echo 调用中运行函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3406441/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com