我每分钟设置一次cron作业,并且在单个查询上运行良好。问题是它仅提交1个表格..如果我想每分钟提交200个查询,该如何设置
* * * * * /usr/bin/wget -O /dev/null https://**.com/cron.php
这是我每1分钟对cronjob网址设置的mysql查询
<?php
$d=strtotime("now");
$day_name =date("Y-m-d\TH:i", $d). "";
include_once('configure/config_cron.php');
include('function.php');
$count=1;
$sel_query="SELECT * FROM blasting where blasting_cron = '$day_name'";
$result = mysql_query($sel_query);
while($row = mysql_fetch_assoc($result)) { ?>
<?php
$blasting_number= "" . protect($row["blasting_number"]). "";
$followup_templates= "" . protect($row["followup_templates"]). "";
echo
"<script>
// URL for request POST /message
var url = 'https://xxxx.com/tokenaa';
var data = {
phone: '$blasting_number', // Receivers phone
body: '$followup_templates', // Message
};
// Send a request
$.ajax(url, {
data : JSON.stringify(data),
contentType : 'application/json',
type : 'POST'
});
</script>
";?>
<?php $count++; } ?>
结果将像这样重复
<script>
// URL for request POST /message
var url = 'https://xxxx.com/tokenaa';
var data = {
phone: '7193847364', // Receivers phone
body: 'hi', // Message
};
// Send a request
$.ajax(url, {
data : JSON.stringify(data),
contentType : 'application/json',
type : 'POST'
});
</script>
<script>
// URL for request POST /message
var url = 'https://xxxx.com/tokenaa';
var data = {
phone: '4578888', // Receivers phone
body: 'hi2', // Message
};
// Send a request
$.ajax(url, {
data : JSON.stringify(data),
contentType : 'application/json',
type : 'POST'
});
</script>
,并且每分钟重新加载cronjob时,它应该自动提交批量数据。