dtbi27903 2013-06-18 03:23
浏览 41

无法从现有的PHP系统外部调用wordpress的API

I have an existing PHP site located on /var/www/A, now I want to add a blog module on /var/www/A/wordpress. I have installed wordpress below /var/www/A successfully. I can visit it via

http://localhost/mysite.com/www/wordpress

Now What I will to do next is : when a user regist on my site, at the same time create a new user in wordpress, so I need to invoke wordpress's API, and I found one wp_insert_user.

I have a User.php and have a login function and I'll wp_insert_user code into it.

Fisrt, import API, I added these two lines on the head of my User.php

define('WP_USE_THEMES', false);
require('/var/www/A/wordpress/wp-blog-header.php');

Second, visit my site via browser. Befor I include two lines, I can via below url to visit logon my site.

http://localhost/mysite.com/www/logon.php

But, after I added two lines, when I visit my site via

http://localhost/mysite.com/www/logon.php

it has been redirect or changed to

http://localhost/mysite.com/www/logon.php/wp-admin/install.php

I notice that I have wp-admin/install.php on my url, but I have installed it before below my project /var/www/A/wordpress, I can visit it via

http://localhost/mysite.com/www/wordpress

What a worese, all the style of my logon.php are completely different.

What should I do next ? Thanks in advance.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料