手册上这些可能是你能用的函数,具体看手册上的示例
1:escapeshellarg -- Escape a string to be used as a shell argument
2:escapeshellcmd -- Escape shell metacharacters
3:exec -- Execute an external program
4:passthru -- Execute an external program and display raw output
5:proc_close -- Close a process opened by proc_open() and return the exit code of that process.
6:proc_get_status -- Get information about a process opened by proc_open()
7:proc_nice -- Change the priority of the current process
8:proc_open --  Execute a command and open file pointers for input/output 
9:proc_terminate -- kills a process opened by proc_open
10:shell_exec -- Execute command via shell and return the complete output as a string
11:system -- Execute an external program and display the output
另外这个函数你可能也可用:
eval //eval -- Evaluate a string as PHP code

解决方案 »

  1.   

    eval('echo "hello world!"');
      

  2.   

    $str="这是一段字符串<?php echo('Hello')?>";
    eval("?>".$str);注意那个"?>",这点很重要!
    目的是结束当前的程序段,否则要出错
    如果是单纯的php代码就不要了
    $str="echo('Hello');";
    eval($str);
      

  3.   

    $str="这是一段字符串<?php echo('Hello')?>";
    eval("?>".$str);这个代码肯定是不能执行的啊,$str里面有字符,还有<?php 这样的标记
      

  4.   

    很明显。xuzuning(唠叨) ( ) 说得不对<? eval ('$a=0;'); ?>实际相当于
    <? $a=0; ?>$str="这是一段字符串<?php echo('Hello')?>";
    但是字符串中有<?、<?php、以及?>字符的时候
    <? eval($str) ?>实际上相当于
    <? 这是一段字符串<?php echo('Hello')?> ?>
    当然会出错啦所以正确的方法是
    <? eval ('?>'.$str.'<?') ?>
    分析之后生成
    <?  ?>这是一段字符串<?php echo('Hello')?><?  ?>至于
    <? eval ('?>'.$str) ?>
    也能正确,我想是因为PHP容错功能吧。。