GG资源网

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

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.

图片转代码服务由CSDN问答提供

感谢您的意见,我们尽快改进~
功能建议

我有一个系统(内置Laravel 4.2),我想将它与Wordpress集成。</ p> \\ n

只有经过身份验证的用户才能访问此博客。</ p>

我认为有2个选项:</ p>

1 - &gt; 在routes.php中包含类似</ p>

  Route :: group(array(\'before\'=&gt;\'auth\')),function(){
Route :: get (“wordpress”,function(){
require_once public_path()。\'/ blog / wp-load.php\';
exit;
});
});
</ code> </ pre >

只有身份验证用户才能看到博客路线。 如果有人试图在没有登录的情况下访问,它将显示404错误(此代码不起作用,只有一个示例)。</ p>

2 - &gt; 将Laravel与Wordpress集成。 在Laravel中创建新用户时,它也将在Wordpress中创建。 当访问博客时,它会自动将用户登录到Wordpress。</ p>
</ div>

网友观点:

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.

###

To create a union user system, I suggest that you use WordPress REST API & OAuth (Authentication System) it has a WordPress plugin you can use the data for both sides, Laravel & WordPress.

To authenticate users from Laravel application to allow them to view WordPress specific directory, you should generate WordPress authentication cookies from Laravel then redirect.

I think these articles may help you to start:

How to use WordPress as a backend for a Laravel Application

Using the WordPress REST API / Authentication

WordPress REST API - OAuth 1.0a Server

由于网站搬家,部分链接失效,如无法下载,请联系站长!谢谢支持!
1. 带 [亲测] 说明源码已经被站长亲测过!
2. 下载后的源码请在24小时内删除,仅供学习用途!
3. 分享目的仅供大家学习和交流,请不要用于商业用途!
4. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
5. 本站所有资源来源于站长上传和网络,如有侵权请邮件联系站长!
6. 没带 [亲测] 代表站长时间紧促,站长会保持每天更新 [亲测] 源码 !
7. 盗版ripro用户购买ripro美化无担保,若设置不成功/不生效我们不支持退款!
8. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
9. 如果你也有好源码或者教程,可以到审核区发布,分享有金币奖励和额外收入!
10.如果您购买了某个产品,而我们还没来得及更新,请联系站长或留言催更,谢谢理解 !
GG资源网 » Laravel集成中的WordPress

发表回复

CAPTCHAis initialing...
© 2021-GG资源网 - www.ggplus.cn. All rights reserved