function run() { DB::escapePost(); Prepare::run(); $this->redirect('/prepare/'); }
<?php /** * 处理下百科里的词状态正常的产品 */ $prepare = new Prepare(); $prepare->run(); class Prepare { private $env = "product"; public function __construct() { if ($this->env == "dev") { $this->conn = new Table("local189"); $this->beanstalk = new \Phalcon\Queue\Beanstalk(array("host" => "192.168.8.189", "port" => 11300)); } else { $this->conn = new Table("txonline"); $this->beanstalk = new \Phalcon\Queue\Beanstalk(array("host" => "172.17.16.101", "port" => 11300)); } } public function run() { $fp = fopen("chongfu.txt", "r"); while (!feof($fp)) { $keyword = trim(fgets($fp)); if (empty($keyword)) { continue; } $dataRs = $this->conn->findOne("select id, keyword, state from gckeyword.key_proword where keyword = '" . $keyword . "' limit 1"); if (empty($dataRs)) { echo "关键词 " . $keyword . " 不存在\n";