我向woocommerce_thankyou
添加了一个有45秒延迟的操作,它会导致页面在执行时挂起45秒。我想知道是否有某种方法将这个挂钩到一个可能在woocommerce thankyou.php
页面构建后触发的动作。我已经尝试在脚本末尾添加我自己的do_action
,但这不起作用。该页面仍然会挂起45秒。
这是行动及其功能......
add_action('woocommerce_thankyou', 'call_restaurant');
function call_restaurant() {
sleep(45);
require_once '/home/mywebsite/public_html/voice/Services/call.php';
$sid = "bla bla bla";
$token = "bla bla bla";
$from_number = "3055551234"; // Calls must be made from a registered Twilio number.
$to_number = "3055551234";
$message = "Hello. You have received a new order from eat three sixty five miami dot com";
$client = new Services_Twilio($sid, $token, "2010-04-01");
/*
$call = $client->account->calls->create(
$from_number,
$to_number,
'http://twimlets.com/message?Message='.urlencode($message)
);
*/
echo 'phone call has been made';
}
我之所以这样做是因为我在订单发出45秒后尝试拨打自动电话。
非常感谢任何帮助。
购物车在这里...... http://www.eat365miami.com/lee-sushi/