简体   繁体   English

无法在Windows中连接R和PHP?

[英]Unable to connect R and PHP in Windows?

I have connected R and php by using the below command in Ubuntu 我在Ubuntu中使用以下命令连接了Rphp

exec("Rscript my_rscript.R  $N", $response);

But i cant able to connect these in Windows. 但我无法在Windows中连接这些。

R installation path is R安装路径是

C:\Program Files\R\R-3.3.1\bin

R file path is R文件路径是

C:\xampp\htdocs\tracker\exec_r.R

This is my PHP code: 这是我的PHP代码:

        <?php 
                // poorman.php 
                echo "<form action='poorman.php' method='get'>"; 
                echo "Number values to generate: <input type='text' name='N' />"; 
                echo "<input type='submit' />"; 
                echo "</form>"; if(isset($_GET['N'])) { 
                    $N = $_GET['N']; 
                    exec("C:\Program Files\R\R-3.3.1\bin C:\xampp\htdocs\tracker\exec_r.R $N", $response); 
                    $str = $response[0]; 
                    $myobj = json_decode($str); 
                    echo $myobj->first_name[0]; 
                } 
        ?> 

这有用吗?

exec("C:\Progra~1\R\R-3.3.1\bin C:\xampp\htdocs\tracker\exec_r.R $N", $response);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM