小编Its*_*Dom的帖子

PHP pthreads:致命错误:找不到类'Thread'

我在我的网络服务器上使用php5.5.现在我想使用pthreads.这是我的php配置:http://dd19010.kasserver.com/infophp.php55

实现此代码后......

 <?php

class AsyncOperation extends Thread
{
    public function __construct($threadId)
    {
        $this->threadId = $threadId;
    }

    public function run()
    {
        printf("T %s: Sleeping 3sec\n", $this->threadId);
        sleep(3);
        printf("T %s: Hello World\n", $this->threadId);
    }
}

$start = microtime(true);
for ($i = 1; $i <= 5; $i++) {
    $t[$i] = new AsyncOperation($i);
    $t[$i]->start();
}
echo microtime(true) - $start . "\n";
echo "end\n";

?>
Run Code Online (Sandbox Code Playgroud)

...问题是这个错误:致命错误:找不到类'Thread'.我是否必须包含一些include_once或类似的东西以使其工作?我需要做什么??

php multithreading pthreads

15
推荐指数
4
解决办法
4万
查看次数

如果找到子域,则从url字符串中删除子域

我有一系列像这样的域名:

domain.com
second.com
www.third.com
www.fourth.fifth.com
sixth.com
seventh.eigth.com
Run Code Online (Sandbox Code Playgroud)

我想要的是一个只返回主机的功能.没有子域名.

这段代码是我到目前为止获取主机名的代码:

$parse = parse_url($url);
$domain = $parse['host'];
Run Code Online (Sandbox Code Playgroud)

但这仅返回:

domain.com
second.com
third.com
fourth.fifth.com
sixth.com
seventh.eigth.com
Run Code Online (Sandbox Code Playgroud)

我需要这个输出:

domain.com
second.com
third.com
fifth.com
sixth.com
eigth.com
Run Code Online (Sandbox Code Playgroud)

php url-rewriting

7
推荐指数
4
解决办法
8948
查看次数

复选框绑定CHANGE事件

我想在用户点击/触摸复选框后提交表单:

HTML

<input type="checkbox" name="chkSales" id="chkSales" class="custom" data-inline="true" data-mini="true"/><label for="chkSales">Sales</label>                                         
<input type="checkbox" name="chkArrival" id="chkArrival" class="custom" data-inline="true" data-mini="true"/><label for="chkArrival">New Arrival</label>                                                         
Run Code Online (Sandbox Code Playgroud)

Js:

$("input[type='checkbox']").change(function() {
    alert(e);
    print(e);
});?
Run Code Online (Sandbox Code Playgroud)

从我在这里阅读它应该真的有用,但id doenst!我的问题在哪里?

(应该是改变,因为移动设备不点击,他们使用触摸... http://jsfiddle.net/usTHG/2/

jquery events bind

6
推荐指数
1
解决办法
2万
查看次数

将3张图像与透明度相结合

我正在研究这个项目,我希望将3个图像组合成一个.

到目前为止有效的是使每个图像(jpg)透明.但在将它们合并到一个新的png图像后,透明度就消失了.

这是代码:

function CreateMyCoolOutfitBaby () {

    $Outfitwidth = 250;
    $Outfitheight = 350;

    $newoutfit = imagecreatetruecolor($Outfitwidth, $Outfitheight); // create empty new image

    $dress = imagecreatefromstring(file_get_contents("http://images180.affili.net/001089/c/bb9c33888aae07d839b6724e31f462bc.jpg"));
    imagealphablending($dress, true);
    $white = imagecolorallocate($dress, 255, 255, 255);
    imagecolortransparent($dress, $white);

    $bag = imagecreatefromstring(file_get_contents("http://images180.affili.net/000698/6/40afc9ed65a94177635d1c7675fd3756.jpg"));
    imagealphablending($bag, true);
    $white = imagecolorallocate($bag, 255, 255, 255);
    imagecolortransparent($bag, $white);

    $shoe = imagecreatefromstring(file_get_contents("http://images180.affili.net/000389/4/4482beed9a949f895debe13d9dd28704.jpg"));
    imagealphablending($shoe, true);
    $white = imagecolorallocate($shoe, 255, 255, 255);
    imagecolortransparent($shoe, $white);




    imagealphablending($newoutfit,true); //on each new layer.

    // UN-COMMENT THIS PARAGRAPH TO SEE SINGLE FILES BEING TRANSPARENT
    //header('Content-Type: image/png');
    //imagepng($dress); // …
Run Code Online (Sandbox Code Playgroud)

php image-processing

2
推荐指数
1
解决办法
462
查看次数