首页 \ 问答 \ Git没有跟踪.rdb redis db文件的更改?(Git is not tracking changes to a .rdb redis db file?)

Git没有跟踪.rdb redis db文件的更改?(Git is not tracking changes to a .rdb redis db file?)

我正在试验,我的很多应用程序都是由.rdb文件中的内容控制的,比如配置和内容。

所以我想我会在我的服务器上设置一个repo,然后在repo redis-cli设置.rdb文件,然后在CONFIG SET dir /path/to/repo/.rdb

然后,当用户添加内容和管理员更新设置时,数据会更改。
理想情况下,我可以将其拉入我的本地分支并进行更新,一切都与服务器一致。

我正在努力的是,Git似乎并没有意识到存在变化。 我添加了一些内容,然后在我的仓库上执行git status ,未检测到任何更改。

我错过了什么吗? 做这样的事情是否可行并且是否可行?


I am experimenting, a lot of my application is controlled by what is inside the .rdb file, like configuration and content.

So I thought I would setup a repo on my server and set the .rdb file inside the repo redis-cli then CONFIG SET dir /path/to/repo/.rdb.

Then data changes as users add content and admins update settings.
Ideally I can pull this into my local branch and have the updates and everything is consistent with the server.

What I am struggling with is, Git does not seem to recognize there is a change. I add some content then do a git status on my repo with no changes detected.

Am I missing something? Is it possible and is it practical to do something like this?


原文:https://stackoverflow.com/questions/36110651
更新时间:2023-04-15 06:04

最满意答案

尝试这个:

$query = mysql_query("INSERT INTO administrator (username, password, permission) VALUES( '$us', '$pa', '$pe' )");

还有一点需要注意,看起来您为了成功的查询而回显两次输出。

你可能想做这样的事情:

if ($query)
{
    $flag["code"] = 1;
    $flag["message"] = "success";
    echo json_encode($flag);


} else {
    // failed to insert row
   $flag["code"] = 0;
   $flag["message"] = "Oops! An error occurred.";
   echo json_encode($flag);
}

 mysql_close($con);

Try this:

$query = mysql_query("INSERT INTO administrator (username, password, permission) VALUES( '$us', '$pa', '$pe' )");

One more thing to note, it looks like you are echoing the output twice for a successful query.

You might want to do something like this instead:

if ($query)
{
    $flag["code"] = 1;
    $flag["message"] = "success";
    echo json_encode($flag);


} else {
    // failed to insert row
   $flag["code"] = 0;
   $flag["message"] = "Oops! An error occurred.";
   echo json_encode($flag);
}

 mysql_close($con);

相关问答

更多
  • 首先不要使用mysql_* api,它的旧版本已弃用,请使用mysqli或PDO 。 对于PHP脚本,您没有向客户端发送有效的json响应。 header('Content-type: application/json'); //put header print(json_encode($flag)); mysql_close($con); 而对于Android使用AsyncTask保持主UI线程免费。 您可以使用像Volley这样的库来让您的生活更轻松。 这将使网络呼叫变得非常容易 更新 PHP与PDO ...
  • 我们面临的One of the Situation是"org.json.JSONException: End of input at character 0 of"是网页不可用。 或者返回空白页面。 在您的情况下,特定链接“ http://www.php-orgil.rhcloud.com/insert_android.php ”也没有网页。 我只是像这样更改网址“ http://php-orgil.rhcloud.com/insert_android.php ”并且它有效。 试试这是其中一个建议 注意:只 ...
  • 尝试这个: $query = mysql_query("INSERT INTO administrator (username, password, permission) VALUES( '$us', '$pa', '$pe' )"); 还有一点需要注意,看起来您为了成功的查询而回显两次输出。 你可能想做这样的事情: if ($query) { $flag["code"] = 1; $flag["message"] = "success"; echo json_encode($f ...
  • 请以这种方式尝试ajax调用 $.ajax({ url: "your api url", type: "post", data: ko.toJSON(self), contentType: "application/json", success: function(data){ console.log(data); alert("success"); }, ...
  • 您的代码仅将单个字符插入数据库的原因是您使用json_encode()将数组$_POST['data_1']转换为字符串,然后尝试将此字符串作为数组访问。 当您使用方括号表示法访问字符串时(在您的代码中: $data_1[$idx] ),PHP将其解释为字符串中的字符访问,从而只生成一个字符。 从PHP手册 : 通过使用方形数组括号在字符串后面指定所需字符的从零开始的偏移量,可以访问和修改字符串中的字符,如$str[42] 。 将字符串视为用于此目的的字符数组。 看看这个工作示例:
  • 尝试将unix时间戳转换为mysql时间戳 if (is_array($data['records'])) { foreach ($data['records'] as $record) { $name = $record['name']; $value = $record['value']; $event = $record['event']; $timestamp = date('Y-m-d H:i:s',$record['timestamp']); file_pu ...
  • 你需要改变 if(method == "POST"){ 至 if(method.equals("POST")){ GET 更改 else if(method == "GET"){ 至 else if(method.equals("GET")){ 比较字符串时,需要使用.equals或.equlasIgnoreCase 编辑: 你得到的是一个字符串,因此不是一个jsonobject 其次改变这个 protected void onPreExecute() { super.onPreExecute(); ...
  • 你需要使用嵌套循环来获取这样的所有值,并尝试理解foreach的使用。 foreach用于遍历数组以获取值直到N'值。 Foreach参考 foreach ($array["allRoundData"] as $row) { $name = $row["name"]; $time = $row['timeLimitInSeconds']; $points = $row['pointsAddedForCorrectAnswer']; ...
  • 你的PHP代码有一些问题。 代码$data = json_decode($jsondata, true); 确实将您的json数据转换为PHP数组。 但是,如果您需要提取需要插入表中的数据,那么您需要这样做 $array_data = $data['CityInfo']; 现在这个$array_data包含需要插入表中的数据数组。您可以继续 $db->save($array_data, "tableName"); 或者您可以使用PHP MySQLi和forEach循环手动插入每一行 $conn = ne ...

相关文章

更多

最新问答

更多
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • 电脑高中毕业学习去哪里培训
  • 电脑系统专业就业状况如何啊?
  • IEnumerable linq表达式(IEnumerable linq expressions)
  • 如何在Spring测试中连接依赖关系(How to wire dependencies in Spring tests)
  • Solr可以在没有Lucene的情况下运行吗?(Can Solr run without Lucene?)
  • 如何保证Task在当前线程上同步运行?(How to guarantee that a Task runs synchronously on the current thread?)
  • 在保持每列的类的同时向数据框添加行(Adding row to data frame while maintaining the class of each column)
  • 的?(The ? marks in emacs/haskell and ghc mode)
  • 一个线程可以调用SuspendThread传递自己的线程ID吗?(Can a thread call SuspendThread passing its own thread ID?)
  • 延迟socket.io响应,并“警告 - websocket连接无效”(Delayed socket.io response, and “warn - websocket connection invalid”)
  • 悬停时的图像转换(Image transition on hover)
  • IIS 7.5仅显示homecontroller(IIS 7.5 only shows homecontroller)
  • 没有JavaScript的复选框“关闭”值(Checkbox 'off' value without JavaScript)
  • java分布式框架有哪些
  • Python:填写表单并点击按钮确认[关闭](Python: fill out a form and confirm with a button click [closed])
  • PHP将文件链接到根文件目录(PHP Linking Files to Root File Directory)
  • 我如何删除ListView中的项目?(How I can remove a item in my ListView?)
  • 您是否必须为TFS(云)中的每个BUG创建一个TASK以跟踪时间?(Do you have to create a TASK for every BUG in TFS (Cloud) to track time?)
  • typoscript TMENU ATagParams小写(typoscript TMENU ATagParams lowercase)
  • 武陟会计培训类的学校哪个好点?
  • 从链接中删除文本修饰(Remove text decoration from links)