小编Mak*_*ijs的帖子

如何显示WP_Mail错误?

如何让 PHP 在 else 语句之后显示确切的错误,而不是回显文本?

这是我使用的代码,我想知道发送邮件后到底出了什么问题:

function deliver_mail() {

// if the submit button is clicked, send the email
if ( isset( $_POST['cf-submitted'] ) ) {

    // sanitize form values
    $name    = sanitize_text_field( $_POST["cf-name"] );
    $email   = sanitize_email( $_POST["cf-email"] );
    $subject = sanitize_text_field( $_POST["cf-subject"] );
    $message = esc_textarea( $_POST["cf-message"] );

    // get the blog administrator's email address
    $to = get_option( 'admin_email' );

    $headers = "From: $name <$email>" . "\r\n";

    // If email has been process for sending, display a success …
Run Code Online (Sandbox Code Playgroud)

php wordpress plugins

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

php ×1

plugins ×1

wordpress ×1