duanbei8904 2017-03-08 03:48
浏览 96
已采纳

Laravel集成中的Wordpress

I have one system (built in Laravel 4.2) and I want to integrate it with Wordpress.

Only authenticaed users can access this blog.

I think in 2 options:

1 -> In routes.php include something like

Route::group(array('before' => 'auth')), function() {
    Route::get("wordpress", function() {
         require_once public_path() . '/blog/wp-load.php';
         exit;
    });
});

Only auth users can see blogs routes. If someone try to access without login, It will show 404 error (this code doesn't work, only one example).

2 -> Integrate Laravel with Wordpress. When create a new user in Laravel, It will create also in Wordpress. When access blog, It will automatically log user into Wordpress.

  • 写回答

2条回答 默认 最新

  • dsfsad089111 2017-06-10 03:34
    关注

    Mahmoud, thank you.

    I solved this problem with the function wp_set_auth_cookie($user_id, true);

    After log-in in my system I call one function that use wp_set_auth_cookie and login the user into Wordpress.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程