试图在Facebook twitter LinkedIn第三方帐户上共享帖子无法使用Laravel发布或共享
我正在尝试上传一张图片并在第三方的所有社交媒体上分享。那么,如何使用Laravel在第三方帐户上共享我的帖子呢。因为我是这个领域的新手,所以请帮助我。我不知道怎么做 这是我为Facebook创建的,用于分享详细信息 .env文件试图在Facebook twitter LinkedIn第三方帐户上共享帖子无法使用Laravel发布或共享,laravel,Laravel,我正在尝试上传一张图片并在第三方的所有社交媒体上分享。那么,如何使用Laravel在第三方帐户上共享我的帖子呢。因为我是这个领域的新手,所以请帮助我。我不知道怎么做 这是我为Facebook创建的,用于分享详细信息 .env文件 FACEBOOK_ID=1xxxxxx2 FACEBOOK_SECRET=9xxxxxxxxxxxxx8 FACEBOOK_URL=http://localhost:8000/login/facebook/callback config/service.php fil
FACEBOOK_ID=1xxxxxx2
FACEBOOK_SECRET=9xxxxxxxxxxxxx8
FACEBOOK_URL=http://localhost:8000/login/facebook/callback
config/service.php file
'facebook_poster' => [
'app_id' => getenv('FACEBOOK_APP_ID'),
'app_secret' => getenv('FACEBOOK_APP_SECRET'),
'access_token' => getenv('FACEBOOK_ACCESS_TOKEN'),
'redirect' => 'http://localhost:8000/login/facebook/callback',
],
上传文件控制器
这是我的控制器,用于上传图像并在facebook上共享
function upload(Request $request)
{
$this->validate($request,[
'select_file' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048'
]);
// dd('done');
$image = $request->file('select_file');
$new_name = rand() . '.' . $image->getClientOriginalExtension();
$image->move(public_path("images"), $new_name);
SendTo::Facebook(
'photo',
[
'photo' => public_path('images/'.$new_name),
//Test this and we will up date the discription
'message' => 'The discription goes here !!'
]
);
return back()->with('success','Image Uploaded Successfully')
->with('path', $new_name);
$user = new file;
$user->name = $file->getClientOriginalName();
$user->save();
return 'data saved in database.';
}
<form method="post" action="{{ url('/uploadfile')}}" enctype="multipart/form-data">
{{ csrf_field() }}
<div class="col-sm-2">
<div class="fb-share-button" data-href="{{Route('home')}}" data-layout="button" data-size="small" data-mobile-iframe="true">
<a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Flocalhost%3A8000%2F&src=sdkpreparse" class="fb-xfbml-parse-ignore">Share</a>
</div>
</div>
</form>
查看为upload.blade.php
这是我的查看文件,显示facebook的共享按钮
function upload(Request $request)
{
$this->validate($request,[
'select_file' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048'
]);
// dd('done');
$image = $request->file('select_file');
$new_name = rand() . '.' . $image->getClientOriginalExtension();
$image->move(public_path("images"), $new_name);
SendTo::Facebook(
'photo',
[
'photo' => public_path('images/'.$new_name),
//Test this and we will up date the discription
'message' => 'The discription goes here !!'
]
);
return back()->with('success','Image Uploaded Successfully')
->with('path', $new_name);
$user = new file;
$user->name = $file->getClientOriginalName();
$user->save();
return 'data saved in database.';
}
<form method="post" action="{{ url('/uploadfile')}}" enctype="multipart/form-data">
{{ csrf_field() }}
<div class="col-sm-2">
<div class="fb-share-button" data-href="{{Route('home')}}" data-layout="button" data-size="small" data-mobile-iframe="true">
<a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Flocalhost%3A8000%2F&src=sdkpreparse" class="fb-xfbml-parse-ignore">Share</a>
</div>
</div>
</form>
{{csrf_field()}}
您不能将凭证张贴在此处。现在可以了吗@C2486不,不好,有编辑历史记录。你应该删除问题我应该删除并重新发布问题吗?@Bracas请重新发布@Braca