Example #1
0
    $dir = $entry . '/list_' . $id3 . '.html';
}
//栏目首页
if (!$dir) {
    SByou_net_mysql2disk();
    if (!$time_up) {
        exit;
    }
    $SByou_Net = $dsql->GetOne("select id from dede_arctype where typedir='{$entry}' limit 1");
    $exist = $SByou_Net['id'];
    if ($exist) {
        $url = $BOOK_URL . 'plus/list.php?tid=' . $entry;
    } else {
        exit;
    }
    sbyou_Net_createdir($entry);
    $dir = $entry . '/index.html';
}
//提取内容
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
$html = curl_exec($ch);
if ($html) {
    //生成静态
    $ok = file_put_contents(dirname(__FILE__) . '/' . $dir, $html);
}
//每页处理时间间隔
$perTime = 1000;
if ($auto) {
Example #2
0
function SByou_net_mysql2disk()
{
    global $dsql;
    $dsql->SetQuery("select id,body from dede_arctiny as a left join dede_addonarticle as b on a.id=b.aid where a.typeid2='0' and a.typeid=b.typeid limit 25");
    $dsql->Execute();
    while ($www_669977_net = $dsql->GetObject()) {
        $id = $www_669977_net->id;
        $body = $www_669977_net->body;
        if (strlen($body) == '46' || strlen($body) == '35') {
            $dsql->ExecuteNoneQuery("update dede_arctiny set typeid2='1' where id='{$id}' limit 1");
            continue;
        }
        $time = time();
        //�����ļ�
        sbyou_Net_createdir('dynamic');
        sbyou_Net_createdir('dynamic/htmltxt');
        sbyou_Net_createdir('dynamic/htmltxt/' . date('Y', $time));
        sbyou_Net_createdir('dynamic/htmltxt/' . date('Y', $time) . '/' . date('m', $time));
        sbyou_Net_createdir('dynamic/htmltxt/' . date('Y', $time) . '/' . date('m', $time) . '/' . date('d', $time));
        sbyou_Net_createdir('dynamic/htmltxt/' . date('Y', $time) . '/' . date('m', $time) . '/' . date('d', $time) . '/' . date('H', $time));
        $content = date('Y', $time) . '/' . date('m', $time) . '/' . date('d', $time) . '/' . date('H', $time) . '/' . md5($id);
        $article = '
		<?php
		$caccnt=\'' . str_replace('\'', '&ldquo;', stripslashes($body)) . '\';
		?>
		';
        file_put_contents('dynamic/htmltxt/' . $content . '.php', $article);
        if (file_exists('dynamic/htmltxt/' . $content . '.php')) {
            $dsql->ExecuteNoneQuery("update dede_arctiny set typeid2='1' where id='{$id}' limit 1");
            $dsql->ExecuteNoneQuery("update dede_addonarticle set body='{$content}' where aid='{$id}' limit 1");
        }
    }
}