function printDoc($name,$table_id,$seat,$id,$device,$db_conn) {
//shell_exec('osk');
$sql = "UPDATE " . DB_USER_TABLE_NAME .
" SET print_count = 1, ipad_id='" . $device .
"' WHERE id =" . $id;
//print_json(format_array("success", "CloudParamPrintWorker.exe " . $name . " " . $table_id . " " . $device));
$res = mysql_query($sql);
if (mysql_affected_rows($db_conn) > 0) {
if ($seat == " ") {
$tid1 = $table_id . "号桌";
$tid2 = "Table " . $table_id;
shell_exec("C:\\CloudParamPrintWorker.exe localhost:5055 DeviceID \"" . $device . "\" name \"" . mb_convert_encoding($name,"gbk","utf8") .
"\" table_id \"" . mb_convert_encoding($tid1,"gbk","utf8") . "\" seat \"" . mb_convert_encoding($tid2,"gbk","utf8") . "\"");
}
else {
$tid1 = $table_id . "号桌" . $seat . "座";
$tid2 = $table_id . " " . $seat;
shell_exec("C:\\CloudParamPrintWorker.exe localhost:5055 DeviceID \"" . $device . "\" name \"" . mb_convert_encoding($name,"gbk","utf8") .
"\" table_id \"" . mb_convert_encoding($tid1,"gbk","utf8") . "\" seat \"" . mb_convert_encoding($tid2,"gbk","utf8") . "\"");
}
print_json(format_array("success", "CloudParamPrintWorker.exe " . $name . " " . $table_id . " " . $device)); $filename = 'plog.txt';
$fh = fopen($filename, "a");
echo fwrite($fh, "CloudParamPrintWorker.exe " . $name . " " . $table_id . " |" . $seat . "| " . $device);
fclose($fh);
//mb_convert_encoding($company,"gbk","utf8")
//print_json(format_array("success", "[" . $name . "]" . "[" . $company . "]" . "[" . $device . "]"));
} else {
//print_json(format_array("error",mysql_error($db_conn)));
}
}
//shell_exec('osk');
$sql = "UPDATE " . DB_USER_TABLE_NAME .
" SET print_count = 1, ipad_id='" . $device .
"' WHERE id =" . $id;
//print_json(format_array("success", "CloudParamPrintWorker.exe " . $name . " " . $table_id . " " . $device));
$res = mysql_query($sql);
if (mysql_affected_rows($db_conn) > 0) {
if ($seat == " ") {
$tid1 = $table_id . "号桌";
$tid2 = "Table " . $table_id;
shell_exec("C:\\CloudParamPrintWorker.exe localhost:5055 DeviceID \"" . $device . "\" name \"" . mb_convert_encoding($name,"gbk","utf8") .
"\" table_id \"" . mb_convert_encoding($tid1,"gbk","utf8") . "\" seat \"" . mb_convert_encoding($tid2,"gbk","utf8") . "\"");
}
else {
$tid1 = $table_id . "号桌" . $seat . "座";
$tid2 = $table_id . " " . $seat;
shell_exec("C:\\CloudParamPrintWorker.exe localhost:5055 DeviceID \"" . $device . "\" name \"" . mb_convert_encoding($name,"gbk","utf8") .
"\" table_id \"" . mb_convert_encoding($tid1,"gbk","utf8") . "\" seat \"" . mb_convert_encoding($tid2,"gbk","utf8") . "\"");
}
print_json(format_array("success", "CloudParamPrintWorker.exe " . $name . " " . $table_id . " " . $device)); $filename = 'plog.txt';
$fh = fopen($filename, "a");
echo fwrite($fh, "CloudParamPrintWorker.exe " . $name . " " . $table_id . " |" . $seat . "| " . $device);
fclose($fh);
//mb_convert_encoding($company,"gbk","utf8")
//print_json(format_array("success", "[" . $name . "]" . "[" . $company . "]" . "[" . $device . "]"));
} else {
//print_json(format_array("error",mysql_error($db_conn)));
}
}
解决方案 »
- 我很想知道PEAR用在什么地方
- 有关PHP的初级问题
- 基于pboc 2.0规范的MAC校验算法
- 由远程获取文件保存到本地的过程中,获取文件数据、获取文件类型(扩展名),免不了要两次读取文件吗?
- win环境,mysql偶尔连不上!
- php的小问题请高手来回答!
- smarty模版做了一个网站,在wamp下运行正常,可是传到linux系统下,网站就出现找不到模版
- ucenter 怎么样做到, 整合的时候,把旧的用户数据同步到新安装的 UCENTER 里面???
- 快过年了,祝phper新年快乐.....散分.
- curl_init()不执行
- BIWEB管理系统安装问题
- php-wget的问题,好像不执行
其实这段代码很简单。
就是读取数据库中的记录,然后根据情况通过shell调用CloudParamPrintWorker.exe 实现打印。
然后写入打印日志。