本文整理汇总了PHP中check::write_file方法的典型用法代码示例。如果您正苦于以下问题:PHP check::write_file方法的具体用法?PHP check::write_file怎么用?PHP check::write_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类check
的用法示例。
在下文中一共展示了check::write_file方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strtolower
$isQuan = 1;
if (stripos($v1, 'http') === false) {
$isQuan = 0;
}
$FileExt = strtolower(strrchr($v1, '.'));
$strFileName = time() . '_' . $k1 . $FileExt;
$strSaveFileName = $strSaveDir . $strFileName;
$strCallFileName = $strDir . $strFileName;
if ($isQuan) {
$objSnoopy->fetch($v1);
} else {
$objSnoopy->fetch($arrGFetch[$_GET['id']]['list_host'] . $v1);
}
$strImg = $objSnoopy->results;
if (!empty($strImg)) {
$isOK = check::write_file($strSaveFileName, $strImg);
}
if ($isOK) {
$strTemp = str_replace($v1, $strCallFileName, $strTemp);
}
}
}
break;
}
$arrSave[$v[0]] .= $strTemp;
if (empty($arrSave[$v[0]])) {
check::AlertExit('标题采集为空,请检查!', -1);
}
if ($v[0] == 'title') {
$arrInfoWhere = check::getAPI($arrGFetch[$_GET['id']]['module_id'], 'getInfoWhere', "WHERE `title` = '{$strTemp}'^id");
if (!empty($arrInfoWhere)) {
示例2: get_table_content
/**
* 生成INSERT 语句
*
* @access public
* @param
*
* @return void
*/
function get_table_content($table, $sql, $mark = false)
{
$trans = array("'" => "\\'", "\n" => '\\n', "\r" => '\\r');
/* 获取数据表数据 */
$strContentTotal = "SELECT count(*) as num FROM {$table}";
try {
$rs = $this->db->prepare($strContentTotal);
$rs->execute();
$intTotal = current($rs->fetch(PDO::FETCH_ASSOC));
} catch (PDOException $e) {
die("Failed: " . $e->__toString());
}
$sql = "\n-- \n-- Dumping data for table `{$table}` \n-- \n\n";
for ($a = 0; $a <= $intTotal; $a += 100) {
$content_query = "SELECT * FROM {$table} limit {$a},100";
try {
$rs = $this->db->prepare($content_query);
$rs->execute();
$arrData = $rs->fetchall(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
die("Failed: " . $e->__toString());
}
/* 创建数据插入语句 */
$tag = true;
$is_first = 1;
foreach ($arrData as $k => $v) {
$sql_insert = '';
if ($tag) {
$keys = array();
$keys = array_keys($v);
$field_names = array();
for ($i = 0; $i < count($keys); $i++) {
$field_names[] = $keys[$i];
}
$table_list = array();
$table_list = implode('`,`', $field_names);
$table_list = '( `' . $table_list . '`)';
$tag = false;
}
reset($keys);
$values = array();
for ($i = 0; $i < count($v); $i++) {
$values[] = str_replace("\\\\'", "\\\\''", strtr($v[$keys[$i]], $trans));
//$values[] = $v[$keys[$i]];
}
$field_values = implode('\', \'', $values);
$field_values = '( \'' . $field_values . '\' )';
$field_values = str_replace("\\'", "''", $field_values);
if ($mark) {
if ($is_first == 1) {
$sql_insert = "INSERT INTO `{$table}` VALUES {$field_values} ,\n";
$is_first++;
} else {
$sql_insert = $field_values . ",\n";
}
} else {
$sql_insert = "INSERT INTO `{$table}` {$table_list} VALUES {$field_values} ;\n";
}
$sql .= $sql_insert;
//echo $sql;exit;
}
if ($mark) {
$sql[strlen($sql) - 2] = ';';
}
if (check::write_file($this->cache, $sql, 'a')) {
$sql = '';
}
}
return true;
}