-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request.php 309行 echo $package,"\n"; #31
Comments
你好
有问题先尝试升级,如果还有问题再提问
发自我的iPhone
…------------------ 原始邮件 ------------------
发件人: 21307369 ***@***.***>
发送时间: 2024年6月8日 10:34
收件人: walkor/http-client ***@***.***>
抄送: Subscribed ***@***.***>
主题: Re: [walkor/http-client] Request.php 309行 echo $package,"\n"; (Issue #31)
<?php namespace app\common; use Monolog\Logger; use Workerman\Http\Client; class httpClient { private static Client $client; public static function init(): void { if (!isset(self::$client)) { $options = [ // 'max_conn_per_addr' => 128, // 'keepalive_timeout' => 10, // 'connect_timeout' => 10, // 'timeout' => 10, ]; self::$client = new Client($options); } } /** * @param string $backUrl * @param array $data * @param Logger $log * @return false * @throws \Throwable */ public static function RequestPost(string $backUrl, array $data): bool { self::init(); self::$client->post($backUrl, $data, function ($response) use ($data, $backUrl, $log) { $body = $response->getBody()->getContents(); if ($response->getStatusCode() === 200 && $body === 'success') { //等待异步通知 } }, function ($exception) use ($data, $backUrl, $log) { //异常处理 } ); return true; } }
很奇怪我有2个地方使用RequestPost 前端请求正常,后端请求 控制台输出日志
POST / HTTP/1.1
Host: xxxxxxx
User-Agent: workerman/http-client
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 127
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
self::$client->post 外部包一个 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
很奇怪我有2个地方使用RequestPost 我有2个应用 一个APP,一个admin APP请求正常,admin请求会在控制台输出
POST / HTTP/1.1
Host: xxxxxxx
User-Agent: workerman/http-client
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 127
The text was updated successfully, but these errors were encountered: