本文整理汇总了PHP中Reader::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Reader::__construct方法的具体用法?PHP Reader::__construct怎么用?PHP Reader::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reader
的用法示例。
在下文中一共展示了Reader::__construct方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function __construct($file, $debug = null)
{
parent::__construct($debug);
if (($this->_file_handler = fopen($file, "r")) == false) {
throw new \Exception("Error: Invalid file");
}
}
示例2: __construct
/**
* Constructor.
*
* @param string $filepath a relative or absolute path to the file.
*
* @param string $delimiter the delimiter that separates columns in the file.
*
* @param string $enclosure (optional, default value is '"') the character that is used for
* enclosing column values.
*
* @param string $escape (optional, default value is '\') the character used for escaping.
*
* For `$delimiter`, `$enclosure`, and `$escape` see also http://php.net/manual/en/function.str-getcsv.php.
*/
public function __construct($filepath, $delimiter, $enclosure = '"', $escape = "\\")
{
parent::__construct($filepath);
$this->delimiter = $delimiter;
$this->enclosure = $enclosure;
$this->escape = $escape;
$this->header = null;
}
示例3: __construct
/**
* Constructor. Creates a new TextReader on an underlying input
* stream with a given charset.
*
* @param io.streams.InputStream stream
* @param string charset the charset the stream is encoded in or NULL to trigger autodetection by BOM
*/
public function __construct(InputStream $stream, $charset = NULL)
{
parent::__construct($stream);
$this->in = Streams::readableFd($stream);
if (NULL === $charset) {
$charset = $this->detectCharset();
}
if (!stream_filter_append($this->in, 'convert.iconv.' . $charset . '/' . xp::ENCODING, STREAM_FILTER_READ)) {
throw new IOException('Could not append stream filter');
}
$this->charset = $charset;
}
示例4:
function __construct($file, $delimiter, $debug = null)
{
parent::__construct($debug);
if (($this->_file_handler = fopen($file, "r")) == false) {
throw new \Exception("Error: Invalid file");
}
if (isset($delimiter)) {
$this->_delimiter = $delimiter;
} else {
throw new \Exception("Error: Not defined delimiter");
}
if (($this->_header = fgetcsv($this->_file_handler, 0, $this->_delimiter)) == false) {
throw new \Exception("Reading of Header was failed");
}
if ($this->_env->isDebugEnv() & ENV_DEBUG_PRINTED) {
var_dump($this->_file_handler);
echo PHP_EOL;
}
}
示例5: __construct
public function __construct()
{
parent::__construct();
$render_ids = Config::render_ids();
if ($render_ids !== NULL) {
if (is_array($render_ids)) {
$this->partial = $render_ids;
} else {
$this->partial[$render_ids] = 1;
}
$skip_ids = Config::skip_ids();
if ($skip_ids !== NULL) {
if (is_array($skip_ids)) {
$this->skip = $skip_ids;
} else {
$this->skip[$skip_ids] = 1;
}
}
} else {
throw new \Exception("Didn't get any IDs to seek");
}
$parents = array();
if (file_exists(Config::output_dir() . "index.sqlite")) {
$sqlite = new \SQLite3(Config::output_dir() . "index.sqlite");
// Fetch all ancestors of the ids we should render
foreach ($render_ids as $p => $v) {
do {
$id = $sqlite->escapeString($p);
$row = $sqlite->query("SELECT parent_id FROM ids WHERE docbook_id = '{$id}'")->fetchArray(SQLITE3_ASSOC);
if ($row["parent_id"]) {
$parents[] = $p = $row["parent_id"];
continue;
}
break;
} while (1);
}
}
$this->parents = $parents;
}
示例6: __construct
public function __construct()
{
parent::__construct();
$render_ids = Config::render_ids();
if ($render_ids !== NULL) {
if (is_array($render_ids)) {
$this->partial = $render_ids;
} else {
$this->partial[$render_ids] = 1;
}
$skip_ids = Config::skip_ids();
if ($skip_ids !== NULL) {
if (is_array($skip_ids)) {
$this->skip = $skip_ids;
} else {
$this->skip[$skip_ids] = 1;
}
}
} else {
throw new \Exception("Didn't get any IDs to seek");
}
}
示例7: __construct
public function __construct($filename)
{
parent::__construct();
$this->_f = fopen($filename, 'rb');
}
示例8: __construct
/**
* Create iterator instance.
*
* @param Archive $archive
* @param array $options
*/
public function __construct(Archive $archive, $options = array())
{
parent::__construct($archive->getFilename(), $archive->getCompression());
$this->options = $options;
}
示例9: __construct
public function __construct($str = '')
{
parent::__construct();
$this->_str = $str;
$this->_pos = 0;
}
示例10: __construct
/**
* Construct the Lexer object
*/
public function __construct()
{
parent::__construct();
$this->line = 1;
$this->column = 1;
}