需要在这方面的帮助1。我需要设计一个用户输入表单,其中有三个文本字段说T1,T2,T3。2.现在,这三个元素的输入应该打包到encode_json 3中。我有一个包含多行的表,其中自动增量id为1,2,3,4,依此类推。现在,应该将相同的编码json消息与id和编码json消息一起传递到文件send_message.php。这是send_message.php
<?php
if (isset($_GET["regId"]) && isset($_GET["message"])) {
$regId = $_GET["regId"];
$message = $_GET["message"];
include_once './GCM.php';
$gcm = new GCM();
$registatoin_ids = array($regId);
$message = array("price" => $message);
$result = $gcm->send_notification($registatoin_ids, $message);
echo $result;
}
?>对于与表相关的循环和行数,您可以使用以下命令
if ($no_of_users > 0) {
?>
<?php
while ($row = mysql_fetch_array($users)) {发布于 2013-06-13 14:42:13
也许cURL就是你要找的东西。对于每一行,您都可以打开到send_message.php的连接并传递所需的数据。
否则,您可以只包含send_message.php,但我不会对此进行重新注释。
根据您的请求编辑,以下是一个非常基本的示例:
<?php
$curlPostfields = array(
'field1'=>$value1,
'field2'=>$value2,
);
$curlHandler = curl_init();
curl_setopt($curlHandler, CURLOPT_URL, 'send_message.php');
curl_setopt($curlHandler, CURLOPT_HEADER, false);
curl_setopt($curlHandler, CURLOPT_POST, true);
curl_setopt($curlHandler, CURLOPT_POSTFIELDS, $curlPostfields);
curl_setopt($curlHandler, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curlHandler);您可以将其打包到一个自己的函数中,然后对表的每一行调用此函数。
https://stackoverflow.com/questions/17080719
复制相似问题