【问题标题】:printer communite(bat) with webapi(php)打印机与 web api(php) 通信(bat)
【发布时间】:2017-04-08 22:01:45
【问题描述】:

我需要通过 api (php) 与打印机 (zebra) 通信。

例如,您在服务器上有一个新数据,您必须有一个指挥棒每 10 秒检查一次,并将文件发送到打印机(打印机在计算机上)。

但我不知道该怎么做,因为我想让它通用。 我正在尝试使用电子,但它不起作用。如果有人有任何想法,我将不胜感激。

【问题讨论】:

    标签: php batch-file zebra-printers printers


    【解决方案1】:

    在服务器上

    <?
    $new="1.txt";
       if(file_exists($new)){
        exec('print /d:\\Network\printer1 c:\accounting\report.txt');
        echo "ok";
       }
    ?>
    

    //在你的电脑上

    <script src="https://code.jquery.com/jquery-3.2.0.min.js"></script>
    <button onclick="start()">Start printing...</button>
    <script>
    function start(){
        setInterval(function(){
    $.ajax({
        url:"http://yourserver.ro/print.php", 
        type:"post", 
        data:({test:"test"}),
        success: function(rsp){ 
        if(rsp=="ok"){
            alert('printing...!')
        };
    }});
    },3000)}
    
    </script>
    

    【讨论】:

    • 打印机映射到计算机,而不是服务器。如何将服务器与安装在我计算机上的打印机进行通信?
    • 在您的 PC 上,您可以在 php 页面上添加它。 每 10 秒重新加载一次页面,以测试 php 脚本
    • 打印机没有收到请求
    猜你喜欢
    • 2016-07-16
    • 1970-01-01
    • 1970-01-01
    • 2013-05-12
    • 1970-01-01
    • 1970-01-01
    • 2013-01-26
    • 2019-05-27
    • 1970-01-01
    相关资源
    最近更新 更多