本文整理汇总了PHP中Sample::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Sample::init方法的具体用法?PHP Sample::init怎么用?PHP Sample::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sample
的用法示例。
在下文中一共展示了Sample::init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Initializes context.
*
* Every scenario gets its own context instance.
* You can also pass arbitrary arguments to the
* context constructor through behat.yml.
*/
public function __construct()
{
$data = new Sample();
$data->init();
}
示例2: Sample
<?php
error_reporting(-1);
ini_set('display_errors', 1);
echo '
<html>
<head><title>Sample Page</title></head>
<body>';
echo '<h1>Sample Page Headline</h1>';
// phpinfo();
include_once 'Sample.php';
$sample = new Sample();
$sample->init();
$sample->set('Tom', 10);
$sample->set('Joe', 20);
$sample->set('Che', 30);
$names = $sample->get_name(10);
echo "<p>ID: {$names[0]['id']} Name: {$names[0]['name']}</p>";
$names = $sample->get_name(30);
echo "<p>ID: {$names[0]['id']} Name: {$names[0]['name']}</p>";
$ids = $sample->get_id('Joe');
echo "<p>ID: {$ids[0]['id']} Name: {$ids[0]['name']}</p>";
echo '</body></html>';