当我想使用laravel中的 mgp25 包将照片上传到instagram时出现无法将值交换为$ photoFilename的问题 在: \ InstagramAPI \ Media \ Photo \ InstagramPhoto($ photoFilename);
更具体地说,我确实收到一条错误消息,提示“输入文件不存在”
答案 0 :(得分:-1)
try {
$ig->login($username, $password);
echo "login ok \n \n \n";
} catch (Exception $e) {
echo 'Something went wrong: ' . $e->getMessage() . "\n \n \n \n";
}
尝试{ $ img = public_path($ photoFilename);
$photo = new \InstagramAPI\Media\Photo\InstagramPhoto($img);
$ig->timeline->uploadPhoto($photo->getFile(), ['caption' => $captionText]);
echo "publicar \n \n \n \n";
} catch (Exception $e) {
echo 'Something went wrong: ' . $e->getMessage() . "\n \n \n ";
}