您现在的位置是:主页 > news > 桂林北站是哪个区/百度云超级会员试用1天
桂林北站是哪个区/百度云超级会员试用1天
admin2025/5/6 8:08:15【news】
简介桂林北站是哪个区,百度云超级会员试用1天,网站建设公司做销售前景好不好,电子商务网站开发实例论文我试图在下面运行这个javascript,但没有看到php shell_exec命令的输出。运行测试——bash脚本将输出一系列ID的34535、25643、23262等。当我用一个简单的PHP文件运行它时,它工作得很好。print shell_exec(/opt/bin/echkchunk -a);但是当我尝试在下面运行…
我试图在下面运行这个javascript,但没有看到php shell_exec命令的输出。
运行测试——bash脚本将输出一系列ID的34535、25643、23262等。当我用一个简单的PHP文件运行它时,它工作得很好。print shell_exec('/opt/bin/echkchunk -a');
但是当我尝试在下面运行它,并选择test1时,没有任何东西输出到屏幕。通过chromes开发人员工具,我可以看到当test1被选择为以下内容时的代码
就好像被注释掉了。
所以我的问题是,是否可以用php和javascript以这种方式运行bash脚本?或者有没有其他方法可以在不使用javascript的情况下将这些信息显示到网页上?
$(document).ready(function() {
$("#selector").on("change", function() {
if ($("#selector").val() == "test1") {
$("#rightselection").css("background-color", "red");
$("#rightselection").html(tester);
}
if ($("#selector").val() == "test2") {
$("#rightselection").css("background-color", "blue");
$("#rightselection").html("test2");
}
if ($("#selector").val() == "test3"){
$("#rightselection").css("background-color", "yellow");
$("#rightselection").html("test3");
}
if ($("#selector").val() == ""){
$("#rightselection").css("background-color", "green");
$("#rightselection").html("This is a Test");
}
});
});
最佳答案:
如果结果是多行的,则需要用转义序列或HTML替换换行标记。尝试替换var tester = '<?php shell_exec("/opt/bin/test -a"); ?>';
具有
var tester = '<?php echo str_replace(PHP_EOL, '
', shell_exec("/opt/bin/test -a")); ?>';