用代码实现访问网址打开应用

1.建立一个html页面且引入jquery.js

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title></title>
    <script src="jq.js"></script>
</head>
<body>
<button id="cmd1" value="notepad">记事本</button>
</body>
</html>
<script>
    $(function(){
        $('#cmd1').click(function(){
            var val=$('#cmd1').val();
            $.get("shell.php",{shell:val},function(msg){
                console.log(msg)
            })
        })
    })
</script>


2.跳转到shell.php页面进行接值

<?php
    $shell=isset($_GET['shell'])?$_GET['shell']:'';
    if($shell!=''){
        echo $shell;
        system($shell);
    }




你可能感兴趣的:(用代码实现访问网址打开应用)