简体   繁体   English

用php读取perl平面文件数据库

[英]Reading perl flat file db with php

I have an old flat file perl db that's part of an eCommerce site I want to migrate to a new php application. 我有一个旧的平面文件perl db,它是我想要迁移到新的php应用程序的电子商务网站的一部分。

Is it possible to read with php the "table" files have no file extension and seem not be just csv's or similar? 有可能用PHP读取“表”文件没有文件扩展名,似乎不只是csv或类似?

If I understand your question correctly, you have the kind of Perl database that's accessed with a so-called bound hash. 如果我正确地理解了您的问题,那么您将拥有使用所谓的绑定哈希访问的Perl数据库。

This uses technology generically known as dbm . 这使用通常称为dbm技术。 The most recent implementation is gdbm , a GNU version, that's described here. 最近的实现是gdbm ,一个GNU版本,在这里描述。 http://www.gnu.org.ua/software/gdbm/ It's likely (but not 100% certain) that's the version used by the Perl infrastructure of your old app. http://www.gnu.org.ua/software/gdbm/这可能(但不是100%肯定)是旧应用程序的Perl基础结构使用的版本。

There's a PHP API with functions like dba_open() that also supports dbm variants. 有一个PHP API,其函数如dba_open()也支持dbm变体。 http://www.php.net/manual/en/ref.dba.php . http://www.php.net/manual/en/ref.dba.php You should be able to handle that file of yours with it. 你应该能够用它来处理你的文件。

It's worth observing that this dba_ extension wasn't loaded in my php implementation until I enabled it explicitly. 值得注意的是,在我明确启用它之前,我的php实现中没有加载这个dba_扩展。 You may have to mess around with various dbm implementations until you find the one that matches. 您可能不得不乱用各种dbm实现,直到找到匹配的实现。 The three I know about are the original UNIX one, dbm , ndbm , and gdbm . 这三个我知道的是原来UNIX之一, dbmndbmgdbm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM