有哪位大侠朋友有使用tonyenc组件的,我项目升级后使用了swow 协程

indesigncs

问题描述

有哪位大侠朋友有使用tonyenc组件的,我项目升级后使用了swow 协程,但使用tonyenc加密后,则无法运行,请问各位大侠有解决方案吗?或者有没有推荐php代码加密或好用的代码混淆工具是支持swow 的呢,谢谢各位大侠!

175 2 0
2个回答

nitron

tonyenc只支持到7.3吧,SWOW要8.0

  • indesigncs 1天前

    tonyenc 是有支持8.1的版本,我现在在偿试使用Fiber好像是 可以,就是感觉比SWOW慢很多

  • indesigncs 1天前
        $cu= Coroutine::getCurrent();
        $id= $cu->id();
        $is= Coroutine::isCoroutine();
    
        $results = [];
        $t= time();
        $parallel = new Parallel();
        for ($i=1; $i<5; $i++) {
            $parallel->add(function () use ($i) {
                sleep(1);
                $cu= Coroutine::getCurrent();
                $id= $cu->id();
                return $id;
            });
        }
        $result2= $parallel->wait();
        $t2= time();
        $results['time']=$t2-$t;
        $results['is']=$is;
        $results['id']=$id;
        $results['r2']=$result2;
        return json($results);

    使用Fiber 测试代码如上, 为什么得到的结果是: {"time":4,"is":true,"id":2,"r2":[3,4,5,6]},不是协程内运行吗?为什么time 还是需要4秒,感觉应该1秒多才正常呀,是我的理解有问题吗?

  • nitron 1天前

    我不清楚,对协程不了解

  • JustForFun 1天前

    用协程就不要用 Fiber 驱动,不然你会误以为它会跟 Go 的协程一样完整,Fiber 不能解决阻塞调用的问题。最好用 Swoole 或 Swow。

smile1

Fiber 没有hook住所有的阻塞操作

  • indesigncs 1天前

    好的,感谢,看来还只能用swow ,就是和 tonyenc 这个加密组件不兼容,有点两难

×
🔝