本文整理汇总了PHP中DBC::getRecordById方法的典型用法代码示例。如果您正苦于以下问题:PHP DBC::getRecordById方法的具体用法?PHP DBC::getRecordById怎么用?PHP DBC::getRecordById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBC
的用法示例。
在下文中一共展示了DBC::getRecordById方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DBC
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU General Public License version 3 license (the "GPLv3"), in which
* case the provisions of the GPLv3 are applicable instead of the above.
*
* @author Tim Kurvers <tim@moonsphere.net>
*/
error_reporting(E_ALL | E_STRICT);
require '../lib/bootstrap.php';
/**
* This example shows basic usage of the World of Warcraft DBC Library API
*/
// Open the given DBC (ensure read-access)
$dbc = new DBC('./dbcs/Spell.dbc');
// Fetch the first record (zero-based); Will return null if no record was found
$record = $dbc->getRecordById(13494);
var_dump($record);
exit;
// Fetch a record by its first field (generally containing the id); Will return null if no record was found
$record = $dbc->getRecordByID(0);
// Check for the 11th record's existence
$exists = $dbc->hasRecord(1);
// Loop over all records in this DBC and query each one
foreach ($dbc as $r) {
var_dump('Record #' . $r->getID() . ' with name: ' . $r->getString(1));
$r->dump(true);
}