[英]i want to run javascript file in my php file with exec() function, but it came up with error message , how can i fix it?
I am writing some PHP code, I tried to run JS in my php with exec() function, but after I run on web browser JS came out with error, what should I do to fix this problem?我正在编写一些 PHP 代码,我尝试在我的 php 中使用 exec() 函数运行 JS,但是在我在网络浏览器上运行 JS 后出现错误,我该怎么做才能解决这个问题?
php php
//after run below code, Javascript runtime error message shown
$response = exec("D:\xampp\htdocs\lazada.js");
echo $response;
I expected the JS could be run successfully after i run my php code on web browser我希望在 Web 浏览器上运行我的 php 代码后 JS 可以成功运行
Load the file content in the variable and print that variable in the HTML.在变量中加载文件内容并在 HTML 中打印该变量。
<?php $jsContent = file_get_contents("D:\xampp\htdocs\lazada.js");?>
<script><?php echo $jsContent;?></script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.