1. 下载php-5.3.28
2. 编译/安装
./configure --prefix=/usr/local/php --enable-fpm --enable-maintainer-zts --with-curl
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>结果数据</title>
</head>
<body>
<?php
$path = $_POST['path'];
$langs = $_POST['langs'];
$key = $_POST['lang-key'];
/**
* load lang files
*/
class lang_thread_run extends Thread
{
public $lang;
public $path;
public $key;
public $data;
public function __construct($lang, $path, $key)
{
$this->lang = $lang;
$this->path = $path;
$this->key = $key;
}
public function run()
{
if(($path = $this->path))
{
require_once($path);
$this->data = constant($this->key);
}
}
}
function zen_href_link($value='')
{
return "";
}
if (!ini_get('display_errors')) {
ini_set('display_errors', '1');
}
if (!empty($langs) && !empty($key)) {
if (empty($path)) {
$file_path = '$.php';
} else {
$file_path = '$/'.$path;
}
$langs = explode(',', $langs);
$res = array();
$thread_array = array();
// get lang by key
foreach ($langs as $value) {
$thread_array[$value] = new lang_thread_run($value, str_replace('$', $value, $file_path), $key);
$thread_array[$value]->start();
}
foreach ($thread_array as $thread_array_key => $thread_array_value)
{
while($thread_array[$thread_array_key]->isRunning())
{
usleep(10);
}
if($thread_array[$thread_array_key]->join())
{
$data_res[$thread_array_key] = $thread_array[$thread_array_key]->data;
}
}
foreach ($langs as $value) {
$res[$value] = $data_res[$value];
}
echo implode(',', $res);
}
?>
</body>
</html>