gpt4 book ai didi

Phpfox::getService ('user.process' )->add($aVals)

转载 作者:行者123 更新时间:2023-11-29 18:04:41 24 4
gpt4 key购买 nike

我想通过外部 PHP 脚本在 phpfox 框架表中插入一些记录 phpfox_user

已应用reference .在表 phpfox_user 中注册用户从 phpfox 外部访问 php 库函数之前工作正常。

$iId = Phpfox::getService('user.process')->add($aVals);

// if fine, $iId is ID of user in `phpfox_user` table, otherwise $iId = false.


<?php
echo "This is the beginning.";
include('auth.php');
include('config1.php');
define('PHPFOX', true);
define('PHPFOX_DS', DIRECTORY_SEPARATOR);
define('PHPFOX_DIR', dirname(__FILE__) . PHPFOX_DS);
define('PHPFOX_START_TIME', array_sum(explode(' ', microtime())));
require_once(PHPFOX_DIR . 'include' . PHPFOX_DS . 'init.inc.php');


$aVals = array(
'full_name' => 'Naveen Kumart',
'email' => 'testrew@abc.com',
'password' => 'Alobha1',
'gender' => 1, // 1: male 2: female
);

if (Phpfox::getParam('core.registration_enable_dob')) {
// if birthday on registration is required, assign birthday parameters here. I give a sample 1/1/1988
$aVals['month'] = '1';
$aVals['day'] = '1';
$aVals['year'] = '1988';


}

$iId = Phpfox::getService('user.process')->add($aVals);

// if fine, $iId is ID of user in `phpfox_user` table, otherwise $iId = false.
if ($iId) {
echo $iId;
} else {
echo 'false';
}

echo "This is the end";


?>

最佳答案

如果您使用 phpFox V4,则替换:

<?php
echo "This is the beginning.";
include('auth.php');
include('config1.php');
define('PHPFOX', true);
define('PHPFOX_DS', DIRECTORY_SEPARATOR);
define('PHPFOX_DIR', dirname(__FILE__) . PHPFOX_DS);
define('PHPFOX_START_TIME', array_sum(explode(' ', microtime())));
require_once(PHPFOX_DIR . 'include' . PHPFOX_DS . 'init.inc.php');

define('PHPFOX_PARENT_DIR', __DIR__ . DIRECTORY_SEPARATOR);
define('PHPFOX_NO_RUN', true);
require('./PF.Base/start.php');

如果您的文件与index.php不在同一目录,请更新PHPFOX_PARENT_DIR

关于Phpfox::getService ('user.process' )->add($aVals),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47993242/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com