本文整理汇总了PHP中SimplePie_Misc::parse_str方法的典型用法代码示例。如果您正苦于以下问题:PHP SimplePie_Misc::parse_str方法的具体用法?PHP SimplePie_Misc::parse_str怎么用?PHP SimplePie_Misc::parse_str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimplePie_Misc
的用法示例。
在下文中一共展示了SimplePie_Misc::parse_str方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($mysql_location, $name, $extension)
{
$host = $mysql_location->get_host();
if (stripos($host, 'unix(') === 0 && substr($host, -1) === ')') {
$server = ':' . substr($host, 5, -1);
} else {
$server = $host;
if ($mysql_location->get_port() !== null) {
$server .= ':' . $mysql_location->get_port();
}
}
if (strpos($mysql_location->get_userinfo(), ':') !== false) {
list($username, $password) = explode(':', $mysql_location->get_userinfo(), 2);
} else {
$username = $mysql_location->get_userinfo();
$password = null;
}
if ($this->mysql = mysql_connect($server, $username, $password)) {
$this->id = $name . $extension;
$this->options = SimplePie_Misc::parse_str($mysql_location->get_query());
if (!isset($this->options['prefix'][0])) {
$this->options['prefix'][0] = '';
}
if (mysql_select_db(ltrim($mysql_location->get_path(), '/')) && mysql_query('SET NAMES utf8') && ($query = mysql_unbuffered_query('SHOW TABLES'))) {
$db = array();
while ($row = mysql_fetch_row($query)) {
$db[] = $row[0];
}
if (!in_array($this->options['prefix'][0] . 'cache_data', $db)) {
if (!mysql_query('CREATE TABLE `' . $this->options['prefix'][0] . 'cache_data` (`id` TEXT CHARACTER SET utf8 NOT NULL, `items` SMALLINT NOT NULL DEFAULT 0, `data` BLOB NOT NULL, `mtime` INT UNSIGNED NOT NULL, UNIQUE (`id`(125)))')) {
$this->mysql = null;
}
}
if (!in_array($this->options['prefix'][0] . 'items', $db)) {
if (!mysql_query('CREATE TABLE `' . $this->options['prefix'][0] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` TEXT CHARACTER SET utf8 NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))')) {
$this->mysql = null;
}
}
} else {
$this->mysql = null;
}
}
}