Table of Contents
回复讨论(解决方案)
当前KVDB缓存内容
清空KVDB缓存后的内容
Home Backend Development PHP Tutorial thinkphp/SAE/数据库操作/D方法 问题

thinkphp/SAE/数据库操作/D方法 问题

Jun 23, 2016 pm 02:23 PM

本地的数据库中本来有一个mesg表,后来在这个表后面增加了一个字段maid。
在某个操作中使用
        $mesg = D('Mesg');
        dump($mesg);

模型里有:
protected $_map = array(
'user'=>'muser',
'content'=>'mcontent',
'time'=>'mtime',
'aid'=>'maid',
);

结果中有这个:
["fields:protected"] => array(8) {
    [0] => string(3) "mid"
    [1] => string(4) "muid"
    [2] => string(5) "muser"
    [3] => string(8) "mcontent"
    [4] => string(5) "mtime"
    [5] => string(4) "maid"//这个
    ["_autoinc"] => bool(true)
    ["_pk"] => string(3) "mid"
  }

在本地里面是有maid字段的。
但是上传到sinaapp上面的时候,还是同样的操作,结果却是:
["fields":protected] => array(7) {
    [0] => string(3) "mid"
    [1] => string(4) "muid"
    [2] => string(5) "muser"
    [3] => string(8) "mcontent"
    [4] => string(5) "mtime"
    ["_autoinc"] => bool(true)
    ["_pk"] => string(3) "mid"
  }

而下面这个无论在本地还是sae上都是正常的:
["_map":protected] => array(4) {
    ["user"] => string(5) "muser"
    ["content"] => string(8) "mcontent"
    ["time"] => string(5) "mtime"
    ["aid"] => string(4) "maid"
  }
本来sae上面的table也是没有那个字段的,后来增加了字段无效,我把所有表重新传上去也无效。
runtime删了很多次也是无效,不知道是什么原因造成的?


回复讨论(解决方案)

先确认 sae 端的表结构已经修改成功
待本地以 sae 方式调试成功后,重新提交整个项目

先确认 sae 端的表结构已经修改成功
待本地以 sae 方式调试成功后,重新提交整个项目

sae表结构是已经修改好的。
“待本地以sae方式调试成功”是什么意思?

先确认 sae 端的表结构已经修改成功
待本地以 sae 方式调试成功后,重新提交整个项目

我现在新建的第二个版本,然后把第一个版本的全部copy过去,然后就好了!!
谢谢!
但是我想知道是什么原因造成的?

在你的机器上你不是用 sae 方式调试的吗?

常规的项目入口文件
require './ThinkPHP/ThinkPHP.php';

SAE的项目入口文件
require './ThinkPHP/Extend/Engine/Sae.php';

先确认 sae 端的表结构已经修改成功
待本地以 sae 方式调试成功后,重新提交整个项目

还有我想问如果不弄第二个版本,怎样将第一个版本整个重新提交?
我不知道应该怎么重新提交。

在你的机器上你不是用 sae 方式调试的吗?

常规的项目入口文件
require './ThinkPHP/ThinkPHP.php';

SAE的项目入口文件
require './ThinkPHP/Extend/Engine/Sae.php';

嗯,这个明白了

还有我想问如果不弄第二个版本,怎样将第一个版本整个重新提交?
我不知道应该怎么重新提交。 你不是用 SVN 软件的吗?
在项目目录上右键-提交即可

引用 5 楼  的回复:

还有我想问如果不弄第二个版本,怎样将第一个版本整个重新提交?
我不知道应该怎么重新提交。
你不是用 SVN 软件的吗?
在项目目录上右键-提交即可

那样提交之后就是没有作用,还是一样有那个问题。
但是我重建一个版本问题就解决了。
不知道为什么。

我也遇到这个问题了。网上搜了下,说是KVDB缓存的问题。然后我禁用KVDB,重新开启,但还是出现这个情况。经过一番折腾才知道禁用KVDB并没有清空缓存,虽然禁用的时候也提示了,但是至少我的没有被清空,原因就不去纠结了。
你可以用下面的代码来查看你的KVDB的缓存内容
[code]$kv = new SaeKV(); 
$ret = $kv->init(); 
$ret = $kv->pkrget('', 100);
dump($ret);
[/code]

如果你禁用并重新开启KVDB后,运行上面代码仍然输出缓存内容,那说明KVDB的缓存还在。
复制下面的代码,执行后解决一切问题。
[code] $kv = new SaeKV();  //创建SaeKV对象
$ret = $kv->init(); //初始化
$ret = $kv->pkrget('', 100);    //获取缓存内容(帮助文档注明了上限为100条)
$this->show('

当前KVDB缓存内容

');
dump($ret);
//遍历并删除
foreach ($ret as $key => $value) {
     $ret = $kv->delete($key);
}
$this->show('
');
$this->show('

清空KVDB缓存后的内容

');
$ret = $kv->pkrget('', 100);  
dump($ret);
if (!$ret){
    $this->show('
');
    $this->show('KVDB清空成功');
};
[/code] 
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

11 Best PHP URL Shortener Scripts (Free and Premium) 11 Best PHP URL Shortener Scripts (Free and Premium) Mar 03, 2025 am 10:49 AM

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

Build a React App With a Laravel Back End: Part 2, React Build a React App With a Laravel Back End: Part 2, React Mar 04, 2025 am 09:33 AM

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Announcement of 2025 PHP Situation Survey Announcement of 2025 PHP Situation Survey Mar 03, 2025 pm 04:20 PM

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio

Notifications in Laravel Notifications in Laravel Mar 04, 2025 am 09:22 AM

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov

See all articles