php - 在linux服务器上发送php图像
问题描述
我有一个 php 机器人,可以发送图片。现在我将它从 Heroku 移到了 Rasberry pi 4 上的 apache 2。效果很好,但我根本无法发送图片。(我可以在heroku上)。Bot 可以访问文件夹,可以从 Internet 保存文件,创建新文件,但不能发送它们。可能是什么问题呢?
我认为代码不是问题,但我把它留在这里
public function sendImage($id, $local_file_path)
{
$upload_url = $this->sendDocuments($id, 'photo')['upload_url'];
$answer_vk = json_decode($this->sendFiles($upload_url, $local_file_path, 'photo'), true);
$upload_file = $this->savePhoto($answer_vk['photo'], $answer_vk['server'], $answer_vk['hash']);
$this->request('messages.send', array('attachment' => "photo" . $upload_file[0]['owner_id'] . "_" . $upload_file[0]['id'], 'peer_id' => $id));
return 1;
}
}
$img_dir=__DIR__ . "/img/";
$vk->sendImage($peer_id, $img_dir."Raid.jpg", "Raid.jpg");
解决方案
推荐阅读
- javascript - 删除画布的函数
- excel - VBA with Selenium - 想要通过 VBA Selenium 在特定站点上上传图像
- azure - 是否需要 Windows 10 Pro 才能将 ASP.NET Core Web 应用程序发布到 Azure?
- javascript - 获取请求未加载 PHP 脚本
- javascript - 完成录制按钮将旧屏幕录制再次保存到本地文件夹
- javascript - 尝试使用 JavaScript 减少 HTML 代码的重复
- xml - 混合元素(具有值和子元素的元素)DTD
- android - E/ModelDownloadManager:模型与TFLite不兼容且app未升级,请勿下载
- javascript - × TypeError:无法读取未定义的属性“图像”
- javascript - Laravel 无限滚动分页(x)与 Like 系统 - Over x post like/unlike 不起作用但如果 post id <= x 则有效