我想在下订单后到达 WooCommerce 感谢页面时写入文件。我将以下内容放在functions.php中:
add_action( 'woocommerce_thankyou', 'test_1', 10, 1 );
function test_1(){
//write to a file when this function is run
$contents = date('m/d/Y h:i:s a', time());
file_put_contents('test.txt', $contents);
}
它不会触发,我想知道为什么会这样?