本文整理匯總了PHP中Basic::printToConsole方法的典型用法代碼示例。如果您正苦於以下問題:PHP Basic::printToConsole方法的具體用法?PHP Basic::printToConsole怎麽用?PHP Basic::printToConsole使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Basic
的用法示例。
在下文中一共展示了Basic::printToConsole方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: content_description
/****** create_tables.php/Include_stuff
* FUNCTION
* Include classes and the config file.
****/
include 'config.php';
require 'class_command.php';
Database::connect();
//Connect to the database
/****** create_tables.php/Create_tables_in_db
* FUNCTION
* Creates the tables in our database.
****/
//Create content_description table
$query = "CREATE TABLE content_description (\n externalpage text NOT NULL,\n title text NOT NULL,\n description text NOT NULL,\n ages varchar(100) NOT NULL default '',\n mediadate date NOT NULL default '0000-00-00',\n priority tinyint(2) NOT NULL default 0\n);\n";
Database::sqlWithoutAnswer($query);
//Create :)
//Create content_links table
$query = "CREATE TABLE content_links (\n catid bigint(8) NOT NULL default '0',\n topic text NOT NULL,\n type varchar(20) NOT NULL default '',\n resource text NOT NULL,\n KEY catid (catid)\n);\n";
Database::sqlWithoutAnswer($query);
//Create :)
//Create structure table
$query = "CREATE TABLE structure (\n catid bigint(8) NOT NULL default '0',\n name text NOT NULL,\n title varchar(255) NOT NULL default '',\n description text NOT NULL default '',\n lastupdate datetime NOT NULL default '0000-00-00 00:00:00',\n KEY catid (catid)\n);\n";
Database::sqlWithoutAnswer($query);
//Create :)
//Create datatypes table
$query = "CREATE TABLE datatypes (\n catid bigint(8) NOT NULL default '0',\n type varchar(20) NOT NULL default '',\n resource text NOT NULL,\n KEY catid (catid)\n);\n";
Database::sqlWithoutAnswer($query);
//Create :)
Basic::printToConsole("\nTables in the database (" . DB_DATABASE . ") are successfully created!\n");
Database::close();
//Close connection
示例2:
$file->setPath('http://rdf.dmoz.org/rdf/content.rdf.u8.gz');
//Set path of what file it is downloading.
$file->download();
//Start the download
$file->extract();
//Extract the file
}
/****** Content_file/Clean_xml
* FUNCTION
* Clean the content file! (dirty xml - we don't like it :D)
****/
if (CONTENT_CLEAN) {
$clean_xml->cleanFile(FILE_RDF_CONTENT);
}
/****** Content_file/Parse_and_insert
* FUNCTION
* Parse and insert the content RDF file into a database
****/
if (CONTENT_PARSE_N_INSERT) {
$parse_content->setStartTime();
//Start time
$parse_content->setXMLFile(FILE_RDF_CONTENT);
//Set what XML file to parse
$parse_content->startParse();
//Start parsing the document
}
//Write to a lastupdate.data file
$filecheck->writeLastUpdate();
Basic::printToConsole('FINISHED - Farewell and thanks for the fish! :)');
Database::close();
//Close connection
示例3: cleanFile
function cleanFile($__filename)
{
Basic::printToConsole("Cleaning {$__filename}\nThis could take some time!");
Basic::printToConsole("\nStatus: ");
//Create a dot object - used to print the dot
$this->count = 0;
$this->frequency = 15000;
//Set the frequency
//Open 2 file pointers - one for read and one for write
$__fp = fopen($__filename, 'r');
$this->_write_fp = fopen('clean_' . $__filename, 'w');
//Continue until you have reached end of file
while (!feof($__fp)) {
$this->_dirty_data = fgets($__fp, 8192);
//Get some dirty data
$this->_correction();
//Clean the dirty data
$this->_dirty_data = '';
//Reset dirty data
}
fclose($__fp);
//Close the pointer
fclose($this->_write_fp);
//Close the pointer
unlink($__filename);
//Delete the old file
//Rename the clean file to the old file
rename('clean_' . $__filename, $__filename);
Basic::printToConsole("\nFinished!\n");
}
示例4: startParse
function startParse()
{
//Starts with clean properties
//(content_links)
$this->topic = '';
$this->type = '';
$this->resource = '';
//(content_description)
$this->external_page = '';
$this->title = '';
$this->description = '';
$this->ages = '';
$this->mediadate = '';
$this->priority = '';
$this->current_tag = '';
//
//Here we specify what tags are legal
//
$this->permitted_tags = array('link', 'link1');
$this->_startToParse();
//Start to parse function [located in XMLGlobal]
//Print out that it is finished!
Basic::printToConsole("Finished processing content RDF file!\nIt took " . $this->h . ' hours, ' . $this->m . ' minutes and ' . $this->s . " seconds\nInserted rows into the database: " . $this->count_rows . "\n");
}
示例5: extract
function extract()
{
Basic::printToConsole("\n\nExtracting the gunzipped file...", false);
//Open the downloaded gunzip file
if (!($file = gzopen($this->filename . ".u8.gz", "r"))) {
basic::error('Fatal error', 'I/O error! Could not open the downloaded file!');
}
//Open the file we write to
if (!($openfile = fopen($this->filename, 'a'))) {
basic::error('Fatal error', 'Cannot open the file (' . $this->filename . ')');
}
//Write the data
while (!gzeof($file)) {
$buff = gzgets($file, 4096);
fputs($openfile, $buff);
}
fclose($openfile);
gzclose($file);
Basic::printToConsole("\n\n " . strtoupper($this->filename) . ".U8.GZ WAS SUCCESSFUL EXTRACTED! \n Filename: " . $this->filename . "\n");
}
示例6: printDot
function printDot()
{
//Don't write the dot every time
$this->count++;
//Used to check out if we just started, and to check if we have reached our frequency.
//If it's reached, then the count will be set to 0.
switch ($this->count) {
case 1:
Basic::printToConsole('.', false);
break;
case $this->frequency:
$this->count = 0;
break;
default:
}
}