本文整理汇总了PHP中PrintText函数的典型用法代码示例。如果您正苦于以下问题:PHP PrintText函数的具体用法?PHP PrintText怎么用?PHP PrintText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PrintText函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateDB
function updateDB($p_ids, $cat_id)
{
$SQL = "UPDATE jobs\n\t\t\t\tSET l_category='{$cat_id}'\n\t\t\t\tWHERE l_id IN({$p_ids})\n\t\t\t\tAND l_category IS NULL";
// PrintText($SQL);
PrintText("Updating DB...");
mysql_query($SQL);
}
示例2: exec_query
function exec_query($sql, $line)
{
$res = mysql_query($sql);
if ($res === FALSE) {
PrintText("Error in line: " . $line . "\n" . mysql_error());
}
return $res;
}
示例3: while
while ($ROW = mysql_fetch_assoc($RS)) {
$cat = $section_node->addChild('Category');
$cat->addChild('Display', $ROW['short_display']);
$cat->addChild('Path', '/' . $_deal_types[$ROW['l_deal_type']] . '/' . $ROW['display']);
}
/*
5.3.3 Get data JOBS
*/
$categories_table_name = "jobs_category";
$SQL = "SELECT \n\t\t\t\t\t\t\t`name`, `display`\n\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\t{$categories_table_name} \n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t`display`<>''\n\t\t\t\t\t\tORDER BY \n\t\t\t\t\t\t\t`order`";
// echo $SQL;
$RS = mysql_query($SQL);
$section_node = $l_oXML->addChild('Jobs');
while ($ROW = mysql_fetch_assoc($RS)) {
$cat = $section_node->addChild('Category');
$cat->addChild('Display', $ROW['display']);
$cat->addChild('Path', '/category/' . $ROW['name']);
}
/*
5.4 Create file
*/
$file_name = $_file_path . $section . '.xml';
file_put_contents($file_name, $l_oXML->asXML());
unset($l_oXML);
$l_oXML = NULL;
/*
6 Close DB connection
*/
mysql_close($link);
PrintText("Finished");
echo "\n";
示例4: die
die("\nCould not connect: " . mysql_error());
}
PrintText("Connected successfully");
mysqli_set_charset('utf8');
mysqli_select_db($l_sTargetDb);
PrintText("'{$l_sTargetDb}' db was selected");
PrintText("Truncating '{$l_sTargetTable}' table...");
$sql = "delete from {$l_sTargetTable}\n\t\t\t\twhere id not in (select id_site from account_to_www)";
mysql_query($sql);
PrintText("Table '{$l_sTargetTable}' has been truncated.");
mysqli_select_db($l_sSourceDb);
PrintText("'{$l_sSourceDb}' db selected");
PrintText("Fetching sites from '{$l_sSourceTable}' table ...");
$sql = "SELECT `www_id`,`www_name`,`www_sections`\n\t\t\t\t FROM {$l_sSourceTable}\n\t\t\t\t WHERE www_name not like '#%'";
$l_oResults = mysql_query($sql);
$l_iTotalResults = mysql_num_rows($l_oResults);
PrintText($l_iTotalResults . " results were found");
PrintText("inserting result into '{$l_sTargetDb}'.'{$l_sTargetTable}' ");
mysqli_select_db($l_sTargetDb);
$l_iCounter = 1;
while ($l_aRow = mysql_fetch_array($l_oResults, MYSQL_ASSOC)) {
$l_sItem_id = $l_aRow["www_id"];
$l_sItem_name = $l_aRow["www_name"];
$l_sSectionsBits = getSectionsBits(explode('|', $l_aRow["www_sections"]));
$sql = "INSERT IGNORE INTO {$l_sTargetTable} (`id`, `name`, `sections_flag`)\n\t\t\t\t\tVALUES\n\t\t\t\t\t(\n\t\t\t\t\t'{$l_sItem_id}',\n\t\t\t\t\t'{$l_sItem_name}',\n\t\t\t\t\t'{$l_sSectionsBits}')\n\t\t\t\t\tON duplicate key UPDATE sections_flag = '{$l_sSectionsBits}'";
$l_sRes = mysql_query($sql);
PrintText($l_iTotalResults . "/" . $l_iCounter . " " . $l_sItem_id . "-" . $l_sItem_name);
$l_iCounter++;
}
PrintText("Update complete!\n");
示例5: while
while ($ROW = mysql_fetch_assoc($RS)) {
$ins[] = "('city', '" . mysql_escape_string($ROW['l_location_city']) . "', '" . $ROW['num'] . "')";
}
$insertion[] = $insert . implode(", ", $ins);
PrintText("Popular cities fetched.");
unset($ins);
$ins = NULL;
// var_dump($insertion);
//Top vacancies from zarplata.ru
PrintText("Reading top vacancies file from zarplata.ru feed...");
$xml_url = 'http://www.zarplata.ru/webservices/export.asmx/TopVacancies';
$xml = simplexml_load_file($xml_url);
$insert = "INSERT INTO popular_jobs(`what`, `title`, `subtitle`) values";
$ins = array();
foreach ($xml as $item) {
// echo "\n".mysql_escape_string($item -> profession);
// echo "\n".$item['url'];
$ins[] = "('top_vacancy', '" . mysql_escape_string($item->profession) . "', 'http://" . $item['url'] . "')";
}
$insertion[] = $insert . implode(", ", $ins);
PrintText("Top vacancies from zarplata.ru fetcheded.");
PrintText("Truncating popular jobs table...");
mysql_query('truncate table popular_jobs');
PrintText("Inserting new values...");
foreach ($insertion as $insert) {
mysql_query($insert);
echo ".";
}
mysql_close($link);
PrintText("Script finished.");
示例6: PrintAuthorName
public function PrintAuthorName()
{
if (isPowerUser()) {
OpenTag('a', 'href="/profile/' . $this->AuthorID . '"');
}
OpenTag('strong');
if (strpos($this->AuthorName, '#') === false) {
PrintText($this->AuthorName);
} else {
$tripchunks = Tripcode($this->AuthorName);
PrintText(htmlentities($tripchunks[0]));
OpenTag('span', 'class="tripcode"');
PrintText('!' . htmlentities($tripchunks[1]));
CloseTag();
}
CloseTag();
if (isPowerUser()) {
CloseTag();
}
if (($this->Flags & REPLY_ADMIN_POST) == REPLY_ADMIN_POST || $this->AuthorID == 'admin') {
echo '<span class="admin_name">##<a href="/' . ADMIN_NAME . '">' . ADMIN_NAME . '</a></span>';
} else {
if (($this->Flags & REPLY_MOD_POST) == REPLY_MOD_POST) {
echo '<span class="admin_name">##<a href="/' . MOD_NAME . '">' . MOD_NAME . '</a></span>';
}
}
PrintText(' ');
}
示例7: PrintText
* Processing the 2nd file - ip blocks:
*/
PrintText("Recreating '{$l_sAuxTableBlocks}' table:");
PrintText("Processing file: '{$l_sBlocks_Filename}'. This can take a while..\n");
while (($data = fgetcsv($l_FileHandler, 1000, ",")) !== FALSE) {
$line_counter++;
if ($line_counter > 2) {
$sql = "INSERT INTO `ru_eyezeek`.`aux_ip_blocks`(`startIpNum`,`endIpNum`,`locId`)\n\t\t\t\t\tVALUES('" . $data[0] . "','" . $data[1] . "','" . $data[2] . "')";
mysql_query($sql);
$l_iPercentage = number_format($line_counter / $l_iTotalIps * 100, 2);
system("echo -ne '{$l_iPercentage} % \r\\c'");
}
}
fclose($l_FileHandler);
PrintText("Done. Total IP blocks found: {$l_iTotalIps}");
// echo"\n\n----------------------Fill the target table----------------------------\n";
PrintText("Porting data into {$l_sTargetTable}");
//Truncating the target table
PrintText("Truncating '{$l_sTargetTable}' table...");
$sql = "TRUNCATE {$l_sTargetTable}";
mysql_query($sql);
PrintText("Table '{$l_sTargetTable}' has been truncated.");
//Join two tables to one
$sql = "INSERT INTO {$l_sTargetTable} (`start_int`,`end_int`,`city`,`lng`,`lat`,`rad`)\n\t\t\tSELECT Blocks.`startIpNum` AS `start_int`, Blocks.`endIpNum` AS `end_int`, Location.`city` AS `city`, Location.`lng` AS `lng`, Location.`lat` AS `lat`, Location.`rad` AS `rad`\n\t\t\tFROM `{$l_sAuxTableLocations}` AS Location\n\t\t\tJOIN `{$l_sAuxTableBlocks}`\t AS Blocks \n\t\t\tON Location.`locId` = Blocks.`locId`";
mysql_query($sql);
PrintText("Table '{$l_sTargetTable}' is Up To Date!\n");
$l_iEndTime = time();
$l_iTotalJob = $l_iEndTime - $l_iStartTime;
echo "{$l_iTotalJob} seconds in Total\n";
scorm_delete_files($l_sParentDirectory);
unset($line_counter, $resp, $fh, $ch);
示例8: elseif
} elseif ($Number == 2) {
echo "<h2> {$String} </h2>";
} elseif ($Number == 3) {
echo "<h3> {$String} </h3>";
} elseif ($Number == 4) {
echo "<h4> {$String} </h4>";
} elseif ($Number == 5) {
echo "<h5> {$String} </h5>";
} elseif ($Number == 6) {
echo "<h6> {$String} </h6>";
} else {
echo "Not a number between 1 and 6";
}
}
for ($x = 1; $x < 7; $x++) {
echo PrintText("String Text", $x);
}
?>
<h1>Step 2 </h1>
<?php
function ByVal($text)
{
$text = "...blah";
echo "<br \\>";
}
function ByRef(&$text)
{
$text = "...blah";
echo "<br \\>";
示例9: fclose
fclose($fin);
echo "\n\n----------------------------------second file-------------------------------------------\n";
//Truncating the table
PrintText("Truncating '{$l_sAuxTableBlocks}' table...");
$sql = "TRUNCATE {$l_sAuxTableBlocks}";
mysql_query($sql);
PrintText("Table '{$l_sAuxTableBlocks}' has been truncated.\n");
//parsing the file
$line_counter = 0;
$fin = fopen($l_sBlocks_Filename, 'r') or die('cant open file');
echo "\nParsing GeoIPCity-134ru-Blocks.csv to SQL table (it will take few minuts)...\n";
while (($data = fgetcsv($fin, 1000, ",")) !== FALSE) {
$line_counter++;
if ($line_counter > 2) {
$sql = "INSERT INTO `ru_eyezeek`.`aux_ip_blocks`(`startIpNum`,`endIpNum`,`locId`)\n\t\t\t\t\tVALUES('" . $data[0] . "','" . $data[1] . "','" . $data[2] . "')";
mysql_query($sql);
//echo"\n[$line_counter]: $sql";
}
}
fclose($fin);
PrintText("\nParsing the files completed!");
//Truncating the target table
PrintText("Truncating '{$l_sTargetTable}' table...");
$sql = "TRUNCATE {$l_sTargetTable}";
mysql_query($sql);
PrintText("Table '{$l_sTargetTable}' has been truncated.");
//Join two tables to one
$sql = "INSERT INTO {$l_sTargetTable} (`start_int`,`end_int`,`region`,`city`)\n\t\t\tSELECT Blocks.`startIpNum` AS `start_int`, Blocks.`endIpNum` AS `end_int`, Location.`region` AS `region`, Location.`city` AS `city`\n\t\t\tFROM `{$l_sAuxTableLocations}` AS Location\n\t\t\tJOIN `{$l_sAuxTableBlocks}`\t AS Blocks \n\t\t\tON Location.`locId` = Blocks.`locId`";
mysql_query($sql);
PrintText("\nMaking the {$l_sTargetTable} table completed!\n");
unset($line_counter, $resp, $fh, $ch);
示例10: array
/**
* all_sitemaps array pattern :
* $all_sitemaps = array(
* 'subdomain_name' => array( 'filename1' => 'ClassName1' , 'filename2' => 'ClassName2' ,) ,
* ...
* 'subdomain_name' => array( 'filename1' => 'ClassName1' , 'filename2' => 'ClassName2' ,) ,
* );
*/
$all_sitemaps = array('realestate' => array('categories' => 'CategoriesMap'), 'vehicles' => array('makemodel' => 'MakeModelMap'), "jobs" => array("titlecity" => "TitleCityMap"));
$all_sitemaps_str = '';
echo "\n";
foreach ($all_sitemaps as $subdomain => $f_sitemaps) {
$list = array();
foreach ($f_sitemaps as $file_name_ => $class_name_) {
sleep(2);
PrintText("Creating {$subdomain} Sitemap: ' {$file_name_} ( {$class_name_}.class )");
require_once RUNNING_PATH . "/" . $subdomain . "/" . $file_name_ . ".php";
$sm_runner = new $class_name_($db_conf);
$sm_runner->fillUrls();
foreach ($sm_runner->getXmlFilesList() as $l_one_map) {
$list[] = "http://" . $subdomain . "." . $sm_runner->getDomainName() . "/" . rawurlencode(preg_replace('%^.+/%u', '', $l_one_map)) . "\n";
}
$sm_runner->reset();
unset($sm_runner);
}
SitemapCronBase::createSitemapIndex($subdomain, $list);
}
function PrintText($p_sTxt)
{
$x = memory_get_usage(TRUE) / 1024;
$x = number_format($x, 2);
示例11: foreach
echo "\n";
foreach ($all_sitemaps as $subdomain => $f_sitemaps) {
foreach ($f_sitemaps as $file_name_ => $class_name_) {
sleep(2);
PrintText("Creating {$subdomain} Sitemap: ' {$file_name_} ( {$class_name_}.class )");
require_once RUNNING_PATH . "/" . $subdomain . "/" . $file_name_ . ".php";
$sm_runner = new $class_name_($db_conf);
$sm_runner->fillUrls();
foreach ($sm_runner->getXmlFilesList() as $l_one_map) {
$all_sitemaps_str .= "Sitemap: http://" . $subdomain . "." . $sm_runner->getDomainName() . "/pic/sitemaps/" . preg_replace('%^.+/%u', '', $l_one_map) . "\n";
}
$sm_runner->reset();
unset($sm_runner);
}
}
echo "_NEW SITE MAPS:\n{$all_sitemaps_str} \n";
$robots_txt = file_get_contents(NETUP_ROBOTS_TXT);
$robots_txt = preg_replace('%^Sitemap\\:.+xml$%m', '', $robots_txt);
$robots_txt = preg_replace('%\\s*\\n+%', "\n", $robots_txt);
$robots_txt = preg_replace('%\\n+$%', "", $robots_txt) . "\n" . $all_sitemaps_str;
if (!file_put_contents(NETUP_ROBOTS_TXT, $robots_txt)) {
PrintText("WRITTING TO ROBOTS TXT WAS UNSUCCESSFUL");
}
echo "___\n{$robots_txt} ___\n";
function PrintText($p_sTxt)
{
$x = memory_get_usage(TRUE) / 1024;
$x = number_format($x, 2);
echo date("d/m/y : H:i:s", time()) . " [Mem: {$x} KB] {$p_sTxt} \n";
}
}
示例12: find_most_popular
private function find_most_popular($city, $one_deal_type, $deal_type_string, $one_translitted_category, $translitted_city)
{
$subdomain = $translitted_city != 'www' ? $translitted_city . '.' : '';
$fields_to_find = array('empty' => 'empty', 'l_roomsint' => 'l_rooms', 'lfoundneigh' => 'l_found_neigh', 'lfoundmetro' => 'l_found_metro');
$found_fields = array();
foreach ($fields_to_find as $one_field => $one_field_db) {
$found_fields[$one_field] = array();
$result = $this->make_search($city, $one_deal_type, $one_translitted_category, $one_field);
if (!empty($result)) {
$matches = $result['matches'];
$ids = array();
if ($one_field == 'empty') {
$found_fields[$one_field] = $result['total_found'];
} else {
foreach ($matches as $match) {
if ($match["attrs"]["@count"] > 5) {
$ids[$match['id']] = $match["attrs"]["@count"];
}
}
if (!empty($ids)) {
$sql = "SELECT {$one_field_db}, l_id FROM `realestate` WHERE l_id IN (" . implode(",", array_keys($ids)) . ")";
$result = array();
$cnt = 0;
$this->db->executeSQL($sql, $res, $cnt);
if ($res) {
// order rows as the IDs were given
foreach (array_keys($ids) as $oneID) {
foreach ($res as $oneRow) {
if ($oneRow['l_id'] == $oneID) {
if (!empty($oneRow[$one_field_db])) {
$found_fields[$one_field][$oneRow[$one_field_db]] = $ids[$oneID];
}
break;
}
}
}
}
}
}
}
}
//category
if (isset($found_fields['empty']) && $found_fields['empty'] > 0) {
$base_url = "http://" . $subdomain . $this->base_domain . "/realty/" . $deal_type_string . "/" . $one_translitted_category . "/";
//$num = $found_fields['empty'];
//$pages = ($num / $this->listings_on_page) + 1;
//$pages = ($pages < $this->max_pages) ? $pages : $this->max_pages - 1;
//for($page = 1; $page <= $pages; $page++){
$link = $base_url;
//if($page > 1){
//$link .= '?p0='.$page;
//}
$this->addUrl($link, 'daily', '0.9', $this->date);
//}
}
//kvartira + rooms
if ($one_translitted_category == 'kvartira') {
$l_roomsint = array();
$four_and_more = 0;
foreach ($found_fields['l_roomsint'] as $rooms => $num) {
if ($rooms > 3) {
$four_and_more += $num;
} else {
if ($rooms > 0) {
$l_roomsint[(int) $rooms] = $num;
}
}
}
if ($four_and_more > 0) {
$l_roomsint[4] = $four_and_more;
}
$found_fields['l_roomsint'] = $l_roomsint;
foreach ($found_fields['l_roomsint'] as $rooms => $num) {
$base_url = "http://" . $subdomain . $this->base_domain . "/realty/" . $deal_type_string . "/" . $one_translitted_category . "/";
//$pages = ($num / $this->listings_on_page) + 1;
//$pages = ($pages < $this->max_pages) ? $pages : $this->max_pages - 1;
//for($page = 1; $page <= $pages; $page++){
if ($rooms > 3) {
$rooms = 4;
}
$link = $base_url . '?rooms=' . $rooms;
//if($page > 1){
//$link .= '&p0='.$page;
//}
$this->addUrl($link, 'daily', '0.9', $this->date);
//}
}
}
//kvartira new
if ($one_translitted_category == 'kvartira' && $deal_type_string == 'sale') {
if ($new_flats_count = $this->find_count_by_field($city, $one_translitted_category, array(array('field' => 'l_deal_type', 'value' => $one_deal_type, 'type' => 'int'), array('field' => 'l_isNew', 'value' => 1, 'type' => 'int')))) {
PrintText("Found " . $new_flats_count . " new flats in " . $translitted_city);
$base_url = "http://" . $subdomain . $this->base_domain . "/realty/" . $deal_type_string . "/" . $one_translitted_category . "/";
//$num = $new_flats_count;
//$pages = ($num / $this->listings_on_page) + 1;
//$pages = ($pages < $this->max_pages) ? $pages : $this->max_pages - 1;
//for($page = 1; $page <= $pages; $page++){
$link = $base_url . '?new=1';
//if($page > 1){
//$link .= '&p0='.$page;
//.........这里部分代码省略.........