且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 Contact Form 7 Textarea 中执行 PHP 代码

更新时间:2023-11-30 16:36:34

除了JpDevs的代码:

In addition to the code of JpDevs:

他在设置 $html 变量时忘记了一些"".这是有效的:

He forgot some ' ' at setting the $html variable. This is working:

function cs7() {
    $var=$_GET['content'];
    $html='<p>'.$var.'</p>';
    return $html;
}

add_shortcode('cs7', 'cs7');

然后只需将 [cs7] 添加到您的表单中.

Then just add [cs7] to your form.

当你使用' '时,你必须通过点连接来写外部的变量:

When you use ' ', you have to write the variables outside by connecting with points:

$result = '<p>'.$var.'</p>';

当你使用"时,你可以把它们写在里面:

When you use " ", you can write them inside:

$result = "<p>$var</p>";