我有以下代码在本地主机上工作但不在真实服务器上工作。
include_once('/home/engforum/public_html/wp-load.php');
global $wpdb, $table_prefix;
$table = $table_prefix . 'users';
$wpdb->insert($table, array(
'user_login'=>$Fields['Name'],
'user_email'=>$Fields['Email'],
'user_pass'=> md5($Fields['Password']),
'user_nicename'=>$Fields['Name'],
'user_registered'=>$Fields['DateInserted'],
'display_name'=>$Fields['Name']
));
$getRegisterID = $wpdb->insert_id;
$my_user = new WP_User($getRegisterID);
$my_user->set_role("subscriber");
// Update User Meta
update_user_meta($getRegisterID, 'rich_editing', 'true');
update_user_meta($getRegisterID, 'show_admin_bar_front', 'true');
update_user_meta($getRegisterID, 'admin_color', 'fresh');
update_user_meta($getRegisterID, 'nickname', $Fields['Name']);
update_user_meta($getRegisterID, 'first_name', $Fields['Name']);
我也尝试检查错误exit( var_dump( $wpdb->last_query ) );
但没有帮助。谁能帮我解决。
更新:我试图用
// display fileds value
echo "<pre>";
print_r($Fields);
echo "</pre>";
exit();
require_once('/home/engforum/public_html/wp-load.php');
global $wpdb, $table_prefix;
但
// Not display fileds value
require_once('/home/engforum/public_html/wp-load.php');
global $wpdb, $table_prefix;
echo "<pre>";
print_r($Fields);
echo "</pre>";
exit();
......