PHP - RethinkDB 给我“加载失败:”错误

问题描述

更新:好的,所以问题是 \r\epochTime(), 当我删除它时,它可以正常工作而没有错误。 有什么想法吗?

我大约一个月前切换到 rethinkdb 并且目前正在运行一个项目,使用它很好。

UPDATE:从数据库中选择时,没有显示错误。仅在插入时。

我正在一个新的 vps 上建立一个新项目,并决定再次使用 rethinkdb,因为它可以保存大量数据。

我的问题是,每当我插入、抓取或删除数据时,它都会向我显示一条烦人的消息。 它显示我“加载失败:(然后我尝试搜索或插入的任何内容)”

  • 例如> [33m 加载失败:/var/www/html/backend/app/App/0xb3fec39fb5b5b39eeeacdfb0a2aca6cc866d5a48.PHP

Take a look at the image here of the error it's showing

我检查了 rethinkdb 的配置文件,一切似乎都很好。

我还为 web 文件授予了 rethinkdb 权限。

我还检查了 rethinkdb 日志文件,那里没有显示任何错误...

新:我刚刚也删除了 rethinkdb_data 文件夹以重新开始,然后重新启动 retrhinkdb 但仍然收到相同的消息...加载失败:

我的 rethinkdb 数据目录位于 /var/www/html/rethinkdb_data/

我不知道为什么它甚至试图进入 /var/www/html/backend/app/App/?

这让我很头疼,因为我找不到任何关于我遇到的问题的文档或错误

有人知道我的问题吗?

使用我的代码更新: (所以我的代码一个api系统)

接收传入数据的第一个文件(index.PHP):

// Adding a new ETHEREUM address
$app->get('/newaccount',function (Request $request,Response $response) use ($ethApi,$accounts) {

$callbackUrl = '';
$destinatioAddress = '';

try {
    // Call EthApi function to make new account
    $password = randomPassword();
    $newAccount = $ethApi->newAccount($password);

    if (!empty($newAccount) || $newAccount !== null) {
        // Good,new account was created,insert into databse and return the data
        // Now insert into database

        $data = [
            'account' => $newAccount,'callback_url' => $callbackUrl,'destination_address' => $destinatioAddress,'dateCreated' => \r\epochTime(time()),'identifier' => randomIdentifier(),'pass' => hashString($password),];

        // Insert the account
        $accounts->insert($data);

        // Return their account address
        $response->withStatus(200);
        $response->withHeader('Content-Type','application/json');
        $message['ok'] = $newAccount;
        return $response->withJson($message);

    } else {
        $response->withStatus(500);
        $response->withHeader('Content-Type','application/json');
        $error['err'] = 'Could not generate a new address';
        return $response->withJson($error);
    }
} catch (PDOException $e) {
    $response->withStatus(500);
    $response->withHeader('Content-Type','application/json');
    $error['err'] = $e->getMessage();
    return $response->withJson($error);
}
});

然后是插入数据库代码 ($accounts->insert($data) 函数

// Insert into accounts
public function insert($data) {
  \r\table("accounts")
    ->insert($data)
    ->run($this->conn);
}

这就是我用来创建 eth 地址的函数以外的所有内容,但它以字符串格式返回一个地址...

您可以在下图中看到,数据插入正常: Check the image of the database here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)