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 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题