RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / 问题

全部问题

Martin Hope
steep
Asked: 2025-03-11 07:14:15 +0000 UTC

如何将数组解析为元素并保存到文件?

  • 4

此代码将数据写入文件

$data = file_get_contents('php://input');
$data = json_decode($data, true);

function writeLogFile($string, $clear = false){
    $log_file_name = __DIR__."/message.txt";
    $now = date("Y-m-d H:i:s");
    if($clear == false) {
        file_put_contents($log_file_name, $now." ".print_r($string, true)."\r\n", FILE_APPEND);
    } else {
        file_put_contents($log_file_name, $now." ".print_r($string, true)."\r\n");
    }
}
writeLogFile($data, false);

这种格式

...
2025-03-11 01:10:28 Array
(
    [update_id] => 82576514
    [message] => Array
        (
            [message_id] => 6618
            [from] => Array
                (
                    [id] => 390344561
                    [is_bot] => 
                    [first_name] => 𝕊𝔹𝔹
                    [last_name] => 𝕚𝕟𝕘
                    [username] => ETR
                    [language_code] => ru
                )

            [chat] => Array
                (
                    [id] => 390344561
                    [first_name] => 𝕊𝔹𝔹
                    [last_name] => 𝕚𝕟𝕘
                    [username] => ETR
                    [type] => private
                )

            [date] => 1741644628
            [text] => Главная
        )

)
...

如何使文件以这种格式写入

2025-03-11 01:10:28 Имя => 𝕊𝔹𝔹, Фамилия => 𝕚𝕟𝕘, Ник => ETR ...

以及在.csv文件中(如何设置此代码?)

$buffer = fopen(__DIR__ . '/file.csv', 'w'); 
fputs($buffer, chr(0xEF) . chr(0xBB) . chr(0xBF));
foreach($string as $val) { 
    fputcsv($buffer, $val, ';'); 
} 
fclose($buffer); 
exit();
php
  • 1 个回答
  • 59 Views
Martin Hope
Николай
Asked: 2025-03-10 22:22:36 +0000 UTC

如何正确处理 Avalonia 中的 TreeView 节点扩展事件?

  • 6

大家好!我最近开始学习 Avalonia,在处理 TreeView 节点扩展事件时遇到了问题。他有一个活动TreeViewItem.Expanded="OnExpanded"

和处理程序

private void OnExpanded(object sender, RoutedEventArgs e)
{
    //...
}

但是这个处理程序没有e.OriginalSource(扩展节点的TreeViewItem)。我确实需要知道哪个结被打开了。

作为节点我使用以下类:

public class Node {
    public Name {get; set;} // К примеру название директории
    public FullName {get; set;} // Полный путь к директории
    public ObservableCollection<Node> SubNodes {get; set;} // Подузлы
}

向 Avalonia 和 MVVM 专家提问:在 MVVM 中解决这个问题是否可以接受?或者这是否需要通过绑定来完成?

c#
  • 1 个回答
  • 78 Views
Martin Hope
Yoel
Asked: 2025-03-10 15:59:00 +0000 UTC

pqxx 构建问题和一堆未定义的引用

  • 4

我正在尝试使用 MinGW 版本 13.2.0 在 Windows 下构建 pqxx。我还使用它编译了 PostgreSQL,因为无法从标准安装的 Postgres 库中编译它。该库本身已编译,IDE 可以看到它,但是在用它构建项目时,它会在 80-84 范围内产生一堆未定义的引用。这个基于 MinGW 中编译的 DBMS 源的库是否会连接到 Windows 上安装的标准 Postgres,我该如何解决这个问题?

我按照BUILDING-cmake 的顺序组装了 pqxx 。

  1. cmake -G "MinGW Makefiles" -DPostgreSQL_ROOT="путь к собранным исходникам Postgres" .
  2. cmake --build .

以下是错误(库路径已更改):

C:/MinGW/bin/mingw32-make.exe -f Makefile.Debug mingw32-make 1:进入目录“D:/Yoel/build-SimpleDatabase-Desktop_Qt_5_14_2_MinGW_64_bit-Debug” g++ -Wl,-subsystem,console -mthreads -o debug\SimpleDatabase.exe debug/main.o -LD:\Yoel\postgresql\lib -lpq -LD:\Yoel\pq\src\libpqxx.a C:\Qt\Qt5.14.2\5.14.2\mingw73_64\lib\libQt5Core.a
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../x86_64-w64-mingw32/bin/ld.exe: debug/main.o: 在函数throw_for_encoding_error': D:\Yoel\build-SimpleDatabase-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/../pq/include/pqxx/internal/encodings.hxx:124:(.text+0x1c6): undefined reference to pqxx::argument_error::argument_error(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)' C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../x86_64-w64-mingw32/bin/ld.exe: debug/main.o: 在函数__static_initialization_and_destruction_0': D:\Yoel\build-SimpleDatabase-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/../pq/include/pqxx/strconv.hxx:80:(.text+0x40b): undefined reference to pqxx::internal::demangle_type_name[abi:cxx11](char const*)' C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../x86_64-w64-mingw32/bin/ld.exe: D:\Yoel\build-SimpleDatabase-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/../pq/include/pqxx/strconv.hxx:80:(.text+0x43b): 对 pqxx::internal::demangle_type_name[abi:cxx11](char const*)' C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Yoel\build-SimpleDatabase-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/../pq/include/pqxx/strconv.hxx:80:(.text+0x46b): undefined reference to pqxx::internal::demangle_type_name[abi:cxx11](char const*)'未定义引用C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Yoel\build-SimpleDatabase-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/../pq/include/pqxx/strconv.hxx:80:(.text+0x49b): 未定义对 pqxx::internal::demangle_type_name[abi:cxx11](char const*)' C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: debug/main.o: in function pqxx::check_version()' 的引用: D:\Yoel\build-SimpleDatabase-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/../pq/include/pqxx/util.hxx:248:(.text$_ZN4pqxx13check_versionEv[_ZN4pqxx13check_versionEv]+0x31): 对pqxx::internal::check_pqxx_version_7_10()' C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: debug/main.o: in function pqxx::connection::connection(char const*)' 未定义引用: D:\Yoel\build-SimpleDatabase-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/../pq/include/pqxx/connection.hxx:287:(.text$_ZN4pqxx10connectionC1EPKc[_ZN4pqxx10connectionC1EPKc]+0x79): 对 pqxx::connection::~connection() ' 未定义引用pqxx::connection::init(char const*)' C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: debug/main.o: in function : D:\Yoel\build-SimpleDatabase-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/../pq/include/pqxx/connection.hxx:329:(.text$_ZN4pqxx10connectionD1Ev[_ZN4pqxx10connectionD1Ev]+0x14): 未定义对“pqxx::connection::close()”的引用 collect2.exe: 错误:ld 返回 1 退出状态 mingw32-make 1 : *** [Makefile.Debug:68: debug/SimpleDatabase.exe] 错误 1 ​​mingw32-make 1 : 离开目录“D:/Yoel/build-SimpleDatabase-Desktop_Qt_5_14_2_MinGW_64_bit-Debug” mingw32-make: *** [Makefile:45: debug] 错误 2

c++
  • 1 个回答
  • 77 Views
Martin Hope
Ворон
Asked: 2025-03-10 03:18:49 +0000 UTC

VS Code 中的终端每隔一段时间启动一次[关闭]

  • 4
已关闭。对这个问题不可能给出一个客观的答案。目前不接受对此问题的答复。

想改进这个问题吗? 重新构建问题,以便可以使用事实和引述来回答。

2 天前关闭。

改进问题

不久前,Visual Studio Code 中出现了一个问题

  1. 我有该程序的最新版本。我打开终端
  2. 有约 50% 的概率它将启动并完全正常运行。但否则它会启动,输入架就站在那里,但你不能输入任何东西
  3. 然后我删除(杀死)该终端并重新启动它。在这种情况下,终端将有 100% 的概率启动,并在一秒钟后自行删除(终止)

我做了什么:

  1. 禁用所有扩展
  2. 以管理员身份启动 VS Code
  3. 将 VS Code 中的默认终端更改为 cmd/powershell 并改回
  4. 我查看了程序日志
  5. 重置所有 VS Coder 设置
  6. 检查 CMD/PowerShell 的功能和版本

正如你所理解的,这并没有带来任何结果。我希望我不是唯一一个,这是新版本的一个错误。

консоль
  • 2 个回答
  • 47 Views
Martin Hope
amarok36
Asked: 2025-03-09 17:04:15 +0000 UTC

每周在 DB2 数据库上执行 SQL 查询

  • 5

有人面临每周在 DB2 数据库上运行 SQL 查询的任务吗?也许有使用数据库本身来解决这个问题的方法?

目前,我唯一的想法是编写一个 bash 脚本并将其执行分配给 Cron 任务调度程序。操作系统 Red Hat Linux。

sql
  • 1 个回答
  • 21 Views
上一页
下一页

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5