使用PHP代码段作为Wordpress中的短代码

时间:2016-05-30 16:59:56

标签: php wordpress

我在Wordpress中使用插件PHP Snippet。它工作正常,但代码中包含一个错误,导致它无法正常工作。

我尝试申请的PHP代码如下:

$StartDate = strtotime('2016-05-10'); //Start date from which we begin count 
$CurDate = date("Y-m-d"); //Current date.
$NextDate = date("Y-m-d", strtotime("+2 week", $StartDate)); //Next date = +2 week from start date
while ($CurDate > $NextDate ) { 
    $NextDate = date("Y-m-d", strtotime("+2 week", strtotime($NextDate)));
}
echo date("Y-m-d", strtotime($NextDate)), "\n;

我需要使用" return"它可以正常工作,但只需更换" echo"通过"返回"没有工作......

你能帮忙吗?

1 个答案:

答案 0 :(得分:0)

这会返回编译器错误:

User.Identity.ProfileImg();

试试这个:

echo date("Y-m-d", strtotime($NextDate)), "\n;

用php连接php中的字符串。

相关问题