Php 需要对短代码属性解析进行故障排除吗

Php 需要对短代码属性解析进行故障排除吗,php,wordpress,datetime,parsing,shortcode,Php,Wordpress,Datetime,Parsing,Shortcode,这是我两年前写的一个复杂函数的一部分,我不记得如何在短代码中传递日期和时间。 结果,该帖子未能发布 我不明白为什么它不起作用,所以我想换一双新的眼睛来看看原因 下面是有问题的代码部分、文章中的短代码和调试日志 请看一看,如果你知道原因,请告诉我。多谢 请参阅代码中的箭头,其中错误发生在每个调试日志的第272行: //Parse the attributes passed from the shortcode for use downstream. Use default where no att

这是我两年前写的一个复杂函数的一部分,我不记得如何在短代码中传递日期和时间。 结果,该帖子未能发布

我不明白为什么它不起作用,所以我想换一双新的眼睛来看看原因

下面是有问题的代码部分、文章中的短代码和调试日志

请看一看,如果你知道原因,请告诉我。多谢

请参阅代码中的箭头,其中错误发生在每个调试日志的第272行:

//Parse the attributes passed from the shortcode for use downstream. Use default where no attribute was passed. Ignore any passed attribute for which there is no default.
    $auc_start = $parsed_atts['auc_start'];
    $auc_end = $parsed_atts['auc_end'];
    $starting_bid = $parsed_atts['start_bid'];
    $bid_increment = $parsed_atts['bid_increment'];
    $human_answer = $parsed_atts['human_answer'];
    $math_sum = $parsed_atts['human_sum'];
    $sell_price = $parsed_atts['sell_price'];

    //Set the time zone for the auction
    date_default_timezone_set("America/Denver");
    //Assign current server time (which is a unix timestamp), adjusted for time zone, to a variable.
    $now = new DateTime();
    //Convert the auction START shortcode attribute (which is a date/time string) to a unix timestamp and assign to a variable.
LINE 272———->>  $auction_start = new DateTime("$auc_start");
    //Convert the auction END shortcode attribute (which is a date/time string) to a unix timestamp and assign to a variable.
    $auction_end = new DateTime("$auc_end");
这是我在短代码中传递的内容:

[jwp_auction auc_start=“2020-02-28 16:15:00" auc_end=“2020-03-01 16:15:00”]
这是调试日志内容:

[28-Feb-2020 16:27:02 America/Denver] PHP Fatal error:  
Uncaught Exception: DateTime::__construct(): 
Failed to parse time string (“2020-02-28) at position 0 (�):
 Unexpected character in 
/var/www/html/wp-content/plugins/jwp_functionality_plugin/jwp_functionality_plugin.php:272

Stack trace:
#0 /var/www/html/wp-content/plugins/jwp_functionality_plugin/jwp_functionality_plugin.php(272): DateTime->__construct('\xE2\x80\x9C2020-02-28')
#1 /var/www/html/wp-includes/shortcodes.php(325): bid_form_display(Array, '', 'jwp_auction')
#2 [internal function]: do_shortcode_tag(Array)
#3 /var/www/html/wp-includes/shortcodes.php(199): preg_replace_callback('/\\[(\\[?)(jwp_au...', 'do_shortcode_ta...', '\n<figure class=...')
#4 /var/www/html/wp-includes/class-wp-hook.php(288): do_shortcode('\n<figure class=...')
#5 /var/www/html/wp-includes/plugin.php(206): WP_Hook->apply_filters('\n<figure class=...', Array)
#6 /var/www/html/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(1550): apply_filters('the_content', '<!-- wp:image {...')
#7 /var/www/html/wp-includes/re in /var/www/html/wp-content/plugins/jwp_functionality_plugin/jwp_functionality_plugin.php on line 272
[28-Feb-2020 16:27:02美国/丹佛]PHP致命错误:
未捕获的异常:日期时间::\u构造():
无法分析位置0处的时间字符串(“2020-02-28”)(�):
中的意外字符
/var/www/html/wp content/plugins/jwp_functionality_plugin/jwp_functionality_plugin.php:272
堆栈跟踪:
#0/var/www/html/wp content/plugins/jwp_functionality_plugin/jwp_functionality_plugin.php(272):DateTime->_构造('\xE2\x80\x9c020-02-28')
#1/var/www/html/wp includes/shortcodes.php(325):出价形式显示(数组,,'jwp\u拍卖')
#2[内部函数]:do\U短码\U标记(数组)

#3/var/www/html/wp includes/shortcodes.php(199):preg_replace_callback('/\\[(\\[?))(jwp_au…,'do_shortcode_ta…,'\n关于wp的内容不多,但是:
[jwp_拍卖auc_start=“2020-02-28 16:15:00”auc_end=“2020-03-01 16:15:00”]
谢谢Jeto!我编辑了引号,但仍然收到相同的错误。其他人有什么想法吗?我在一个变量中找到了一个额外的空间来克服此错误。现在解决进一步的问题:/哪些进一步的问题?请用更新的信息编辑您的问题。事实证明,我正在处理一些没有问题的错误。我将在这里发布一个新的问题,如果需要关于这些方面的帮助。还发现你提到的引用是导致问题的原因,以及额外的空间。感谢Jets捕捉到这一点!