python璋冪敤php鍑芥暟,,鏍囩锛?/p>鐢变


鏍囩锛?/p>

鐢变簬php涓嶆敮鎸佸绾跨▼锛屾墍浠ユ兂鍊熷姪python鎼炰竴涓€?br />1.import subprocess
import time
#Simplecaller, disguard output
method="diao"
for i in range(2):
time1=time.time()
#print i
#subprocess.call("php h.php")
proc = subprocess.Popen("php h.php " + method, shell=True,stdout=subprocess.PIPE)
response = proc.stdout.read()
time2=time.time()-time1;
print time2
print response
time.sleep(1)

php
$method = $argv[1];

function diao(){
static $num;
echo "\n";
echo "php璋冪敤".$num."娆?;
echo $num+=1;
};
if(isset($method) && $method != ""){
$method();
}else{
echo "No function to call.";
}
subprocess璁茶В


2.python 澶氱嚎绋?br />fromtimeimportctime,sleep
def music():
for i in range(2):
print"I was listening to music. %s"%ctime()

sleep(1)
def move():
for i in range(2):
print"I was at the movies! %s"%ctime()
sleep(5)
if__name__==鈥榑_main__鈥?
music()
move()
print"all over %s"%ctime()

鏉ヨ嚜锛歨ttp://bbs.php-z.com/thread-3091-1-1.html

python璋冪敤php鍑芥暟

鏍囩锛?/p>

鍘熸枃鍦板潃锛歨ttp://www.cnblogs.com/yhdsir/p/5536545.html

相关内容

    暂无相关文章

评论关闭