一个Curl的耗时长的问题
发现某个接口请求很慢,但是后端确认接口是很快的。 在机器上通过shell执行curl命令,确实很快,但是PHP代码里请求又确实很慢。 业务里用到了Requests这个库,一开始以为是这个库导致的问题。 ...
发现某个接口请求很慢,但是后端确认接口是很快的。 在机器上通过shell执行curl命令,确实很快,但是PHP代码里请求又确实很慢。 业务里用到了Requests这个库,一开始以为是这个库导致的问题。 ...
今天讲一下BeanProcessor模块,先看一下handle方法实现。 /** * Handle bean * * @return bool * @throws ReflectionException * @throws AnnotationException */ public function handle(): bool { if (!$this->application->beforeBean()) { return false; } $handler = new BeanHandler(); $definitions = $this->getDefinitions(); $parsers = AnnotationRegister::getParsers(); $annotations = AnnotationRegister::getAnnotations(); BeanFactory::addDefinitions($definitions); BeanFactory::addAnnotations($annotations); BeanFactory::addParsers($parsers); BeanFactory::setHandler($handler); BeanFactory::init(); /* @var Config $config*/ $config = BeanFactory::getBean('config'); CLog::info('config path=%s', $config->getPath()); CLog::info('config env=%s', $config->getEnv()); $stats = BeanFactory::getStats(); CLog::info('Bean is initialized(%s)', SwoftHelper::formatStats($stats)); return $this->application->afterBean(); } 先通过getDefinitions方法获取所有的Bean定义。 ...
上一篇介绍了,SwoftApplication里定义了6个Processor对象。 protected function processors(): array { return [ new EnvProcessor($this), new ConfigProcessor($this), new AnnotationProcessor($this), new BeanProcessor($this), new EventProcessor($this), new ConsoleProcessor($this), ]; } 所有的Processor实现都在framework\src\Processor目录下。 ...
Swoft 是一款基于 Swoole 扩展实现的 PHP 微服务协程框架。 以前一直都是用的原生swoole框架,最近有时间研究了下衍生的Swoft框架。 刚开始看的时候,感觉自己像个原始人,完全看不懂。 ...
代码如下 <?php echo 9.99997600 + 2.4E-5; echo "\n===\n"; echo bcadd(9.99997600, 2.4E-5, 8); 结果为 10 === 9.99997600 问了朋友,查了各种资料,终于在PHP手册里发现了这段话。 Caution Passing values of type float to a BCMath function which expects a string as operand may not have the desired effect due to the way PHP converts float values to string, namely that the string may be in exponential notation (which is not supported by BCMath), and that the decimal separator is locale dependent (while BCMath always expects a decimal point). ...
什么是Flink。 Apache Flink® - Stateful Computations over Data Streams Flink安装参考(官方文档)[https://ci.apache.org/projects/flink/flink-docs-release-1.7/tutorials/local_setup.html]。 ...
今天安装hugofy的包时,一直遇到"There Are No Packages Available for Installation"的错误。 按网上的教程,配置host,配置代理都不起作用。 ...
从2011年开始写博客,博客程序从WordPress换成Typecho。 早就有想法换成静态博客,一直没时间搞。 2019年了,新年新气象,用hugo + github pages搞了个新博客。 ...