本文整理汇总了PHP中fgetss函数的典型用法代码示例。如果您正苦于以下问题:PHP fgetss函数的具体用法?PHP fgetss怎么用?PHP fgetss使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fgetss函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _initialize
function _initialize()
{
if (false == ListMobile() && allowPhone()) {
//Header("Location:http://m.ishoutou.com".$_SERVER['REQUEST_URI']);
$url = "http://m.ishoutou.com" . $_SERVER['REQUEST_URI'];
echo "<script language='javascript' type='text/javascript'>";
echo "window.location.href='{$url}'";
echo "</script>";
exit;
}
$filename = "/home/www/default/AllowList.txt";
if (file_exists($filename)) {
$handle = fopen($filename, 'rb');
while (!feof($handle)) {
$contxt123[] = fgetss($handle, 1024);
}
foreach ($contxt123 as $val) {
$tt = trim($val);
if (false === empty($tt)) {
$tmparr[] = $tt;
}
}
$ipadds = get_client_ip();
if (!in_array($ipadds, $tmparr)) {
header('HTTP/1.1 404 Not Found');
header("status: 404 Not Found");
die('HTTP/1.1 404 Not Found');
}
}
$this->tempswich();
}
开发者ID:caotieshuan,项目名称:ishoutou,代码行数:31,代码来源:GCommonAction.class.php
示例2: thes_search
function thes_search(&$irc, &$data, $url, $param)
{
$buffer = "";
if ($fp = fsockopen("thesaurus.reference.com", 80, $errno, $errstr, 30)) {
fputs($fp, "GET {$url} HTTP/1.0\r\nHost: thesaurus.reference.com\r\n\r\n");
while (!feof($fp)) {
$buffer .= fgetss($fp, 1024);
}
fclose($fp);
$this->log($irc, $data, "thes for " . $param);
} else {
$this->log($irc, $data, "thes for " . $param . " and socket failed : {$errstr} ({$errno})");
}
$start = strpos($buffer, 'Entry:') + 6;
echo substr($buffer, 0, 255);
$buffer = substr($buffer, $start);
echo substr($buffer, 0, 255);
$end = strpos($buffer, 'Source:');
$buffer = substr($buffer, 0, $end);
echo substr($buffer, 0, 255);
$buffer = html_entity_decode($buffer);
$buffer = str_replace("\n", ' ', $buffer);
if ($buffer) {
$this->talk($irc, $data, $buffer);
} else {
$this->talk($irc, $data, 'Search string not found');
}
}
开发者ID:BackupTheBerlios,项目名称:lulubot,代码行数:28,代码来源:thesaurus.php
示例3: changePassword
public function changePassword($mewpassword)
{
$ret = "";
$fp = fopen($this->remoteUrl . "/cpwd.asp?name=" . $this->userName . "&pwd=" . $this->userPassword . "&newpwd={$mewpassword}", "r");
$ret = fgetss($fp, 255);
fclose($fp);
return $ret;
}
开发者ID:lanma121,项目名称:prize,代码行数:8,代码来源:Sms.php
示例4: doRead
function doRead()
{
// strip HTML tags from the read line
$line = fgetss($this->fp, 4096);
// convert HTML entities to valid UTF-8 characters
$line = String::html2utf($line);
// slightly (~10%) faster than above, but not quite as accurate, and requires html_entity_decode()
// $line = html_entity_decode($line, ENT_COMPAT, strtoupper(Config::getVar('i18n', 'client_charset')));
return $line;
}
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:10,代码来源:SearchHTMLParser.inc.php
示例5: resolveFileFromParent
public static function resolveFileFromParent($collectionHandle, $path)
{
if (!($parentConfig = Site::getParentHostConfig())) {
return false;
}
// get collection for parent site
$collection = SiteCollection::getOrCreateRootCollection($collectionHandle, $parentConfig['ID']);
$fileNode = $collection->resolvePath($path);
// try to download from parent site
if (!$fileNode) {
$remoteURL = 'http://' . $parentConfig['Hostname'] . '/emergence/';
$remoteURL .= $collectionHandle . '/';
$remoteURL .= join('/', $path);
$remoteURL .= '?accessKey=' . $parentConfig['AccessKey'];
$cache = apc_fetch($remoteURL);
if ($cache == '404') {
return false;
}
//if(isset(self::$cache[$cacheKey])) {
// $fp = self::$cache[$cacheKey];
//}
$fp = fopen('php://memory', 'w+');
//print("Retrieving: <a href='$remoteURL' target='_blank'>$remoteURL</a><br>\n");
$ch = curl_init($remoteURL);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, true);
if (!curl_exec($ch)) {
throw new Exception('Failed to query parent site for file');
}
if (curl_errno($ch)) {
die("curl error:" . curl_error($ch));
}
// write file to parent site collection
fseek($fp, 0);
// read status
$statusLine = trim(fgetss($fp));
list($protocol, $status, $message) = explode(' ', $statusLine);
if ($status != '200') {
apc_store($remoteURL, '404');
return false;
}
// read headers
while ($header = trim(fgetss($fp))) {
if (!$header) {
break;
}
list($key, $value) = preg_split('/:\\s*/', $header, 2);
//print "$key=$value<br>";
}
$collection->createFile($path, $fp);
$fileNode = $collection->resolvePath($path);
}
return $fileNode;
}
开发者ID:JarvusInnovations,项目名称:Emergence-preview,代码行数:54,代码来源:Emergence.class.php
示例6: readTextFromFile
function readTextFromFile($file)
{
$file_string = '';
$handle = @fopen($file, "r");
if ($handle) {
while (!feof($handle)) {
$file_string .= fgetss($handle, 4096);
}
fclose($handle);
}
return $file_string;
}
开发者ID:simpsonjulian,项目名称:puppet-wordpress,代码行数:12,代码来源:file.php
示例7: createBoot
public static function createBoot($rootPath)
{
$boot = $rootPath . DIRECTORY_SEPARATOR . 'app';
static::mkdir($boot);
static::mkdir($boot . '/config');
static::mkdir($boot . '/views');
if (!file_exists($boot . '/Application.php')) {
copy(__DIR__ . '/init/app/Application.php', $boot . '/Application.php');
}
if (!file_exists($boot . '/config/global.php')) {
copy(__DIR__ . '/init/app/global.php', $boot . '/config/global.php');
}
if (!file_exists($boot . '/console')) {
copy(__DIR__ . '/init/app/console', $boot . '/console');
}
$ignoreFile = $rootPath . '/.gitignore';
if (!file_exists($ignoreFile)) {
touch($ignoreFile);
}
$handle = fopen($ignoreFile, "r");
$defineIgnore = [];
if ($handle) {
while (($buffer = fgetss($handle, 4096)) !== false) {
$buffer = trim(str_replace(PHP_EOL, '', $buffer));
if (!empty($buffer)) {
$defineIgnore[] = $buffer;
}
}
fclose($handle);
}
$length = count($defineIgnore);
if (empty($defineIgnore)) {
file_put_contents($ignoreFile, <<<IGNORE
/app
/bin
/.idea
/vendor
/public
IGNORE
);
} else {
foreach ($defineIgnore as $key => $val) {
foreach (['/public', '/app', '/bin', '/.idea', '/vendor'] as $index => $ignore) {
if (false === @strpos($ignore, $val) && $key === $length) {
file_put_contents($ignoreFile, $ignore, FILE_APPEND);
}
}
}
}
}
开发者ID:JanHuang,项目名称:fast.module,代码行数:51,代码来源:Module.php
示例8: loadProperties
public static function loadProperties($file)
{
$properties = array();
$fp = fopen($file, 'r');
while ($line = fgetss($fp)) {
// clean out space and comments
$line = preg_replace('/\\s*([^#\\n\\r]*)\\s*(#.*)?/', '$1', $line);
if ($line) {
list($key, $value) = explode('=', $line, 2);
$properties[$key] = $value;
}
}
fclose($fp);
return $properties;
}
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:15,代码来源:Sencha.class.php
示例9: readPut
/**
* PUTのデータの解決
*/
private function readPut()
{
$this->requests_ = array();
$putdata = @fopen("php://input", "r");
if ($putdata) {
while (!feof($putdata)) {
$line = fgetss($putdata);
$tokens = split('=', $line);
if (count($tokens) != 2) {
continue;
}
$key = rawurldecode($tokens[0]);
$value = rawurldecode($tokens[1]);
$this->requests_ += array($key => trim($value));
}
}
}
开发者ID:vipp-art,项目名称:VipNazoMOTRPG,代码行数:20,代码来源:Request.php
示例10: install_tables_data
public function install_tables_data($filename)
{
if ($this->the_plugin->verifyFileExists($filename)) {
//verify file existance!
global $wpdb;
$file_handle = fopen($filename, "rb");
if ($file_handle === false) {
return false;
}
while (!feof($file_handle)) {
$sql = fgetss($file_handle);
if ($sql === false || empty($sql) || trim($sql) == '') {
continue 1;
}
$sql = str_replace('{wp_prefix}', $wpdb->prefix, $sql);
$wpdb->query($sql);
}
fclose($file_handle);
}
return false;
//return error!
}
开发者ID:shahadat014,项目名称:geleyi,代码行数:22,代码来源:default-sql.php
示例11: massSend1
public function massSend1($mob,$content, $time, $isSub=false) {
if(!$isSub){
$uid = $this->msgconfig ['sms'] ['user']; // 分配给你的账号
$pwd = $this->msgconfig ['sms'] ['pass']; // 密码
}else{
$uid = $this->msgconfig ['sms'] ['subuser']; // 分配给你的账号
$pwd = $this->msgconfig ['sms'] ['subpass']; // 密码
}
$mob = $mob; // 发送号码用逗号分隔
$content = urlencode ( auto_charset ( $content, "utf-8", 'gbk' ) ); // 短信内容
// 功能:发送短信
// $time = date('YmdHi',time());
// 备用IP地址为203.81.21.13
$fp = fopen ( $this->ismsinfo ["MASSSEND_URL"] . "?name=$uid&pwd=$pwd&dst=$mob&msg=$content&time=$time", "r" );
$ret = fgetss ( $fp, 255 );
$ret = auto_charset ( $ret, "gbk", 'utf-8' );
fclose ( $fp );
$data = dealSmsResult ( $ret );
return $data;
}
开发者ID:hutao1004,项目名称:yintt,代码行数:22,代码来源:SmsUrlInvoke.class.php
示例12: getUsers
function getUsers()
{
$users = array();
//deal with users.txt
if (file_exists("users.txt")) {
$fileptr = fopen("users.txt", "r");
if (flock($fileptr, LOCK_EX)) {
//check each user line
while ($curruser = fgetss($fileptr, 512)) {
//user = thing before ^, or splitusertime[0]
//times = comes after ^, or splitusertime[1]
//times split by |
$splitusertime = explode("^", $curruser);
$splittimes = explode("|", rtrim($splitusertime[1]));
$users[$splitusertime[0]] = $splittimes;
}
}
flock($fileptr, LOCK_UN);
}
//users are in username => list of times pair
return $users;
}
开发者ID:rk5dy,项目名称:CS4501WebPLHW,代码行数:22,代码来源:hw1funcs.php
示例13: foreach
require 'db_connect.php';
}
foreach ($files as $key => $filename) {
$i = $i + 1;
echo '<tr><td>' . $i . '</td><td>' . iconv('Windows-1251', 'UTF-8', $filename) . '</td>';
//распаковываем файлы в папку test
if ($zip->open($dir . $filename) === TRUE) {
$zip->extractTo('test/' . $filename . '/');
$zip->close();
} else {
echo 'Не удалось распаковать файл' . $filename;
}
//достаем текст из распакованных файлов, удаляем пробелы и считаем количество символов
$file = fopen('/home/localhost/www/mystats/test/' . $filename . '/word/document.xml', 'r');
while (!feof($file)) {
$text = $text . fgetss($file);
}
fclose($file);
$text_without_spaces = str_replace(' ', '', $text);
$text = FALSE;
//очищаем переменную $text
$numb_char_without_spaces = mb_strlen($text_without_spaces, "utf-8");
echo '<td>' . $numb_char_without_spaces . '</td>';
//Добавляем данные в БД.
$query = mysqli_query($dbc, 'INSERT INTO `day_stats` (`filename`, `dates`, `price`, `size`, `client`) VALUES ("' . iconv('Windows-1251', 'UTF-8', $filename) . '", "' . date('Y.m.d.') . '", "' . $price . '", "' . $numb_char_without_spaces . '", "' . $client . '")');
$totalchar += $numb_char_without_spaces;
echo '<td>' . $totalchar . '</td></tr>';
}
echo '</table>';
echo '<br> Итого:' . $totalchar;
?>
开发者ID:strangerkir,项目名称:MyStats-Repo,代码行数:31,代码来源:char_count.php
示例14: extractSave
function extractSave($fp)
{
$db = connectDB();
$note = 'Note';
$note_zh = '笔记';
$bookmark = "Bookmark";
$bookmark_zh = '书签';
$loc_delimiter = 'Loc.';
$loc_delimiter_zh = '#';
$type_delimiter = '的';
$time_delimiter = '| Added on ';
$time_delimiter_zh = '| 添加于 ';
$bname_note = array();
$row_cnt = 0;
// 读取文件内容
while (!feof($fp)) {
$line = fgetss($fp);
switch ($row_cnt) {
case 0:
$row_cnt++;
$first = explode('(', $line);
$bname = $first[0];
$author = $first[1];
$author = explode(')', $author);
$author = trim($author[0]);
break;
case '1':
$row_cnt++;
if (!strpos($line, $time_delimiter_zh)) {
$second = explode($time_delimiter, $line);
$time = $second[1];
$type_loc = explode($loc_delimiter, $second[0]);
$type = trim($type_loc[0], '-');
$type = trim($type);
// 清除字符串中的空格和'-'
$loc = trim($type_loc[1]);
} else {
$second_ = explode($time_delimiter_zh, $line);
$time = $second_[1];
$type_loc = explode($loc_delimiter_zh, $second_[0]);
$typeloc = $type_loc[1];
$tmp = explode($type_delimiter, $typeloc);
$loc = trim($tmp[0]);
$type = trim($tmp[1]);
}
break;
case '2':
$row_cnt++;
break;
case '3':
$row_cnt++;
$content = $line;
break;
case '4':
$row_cnt = 0;
if ($type == $note || $type == $note_zh) {
$note_link = "SELECT * FROM note WHERE bookname LIKE '%" . $bname . "%'";
$note_res = $db->query($note_link);
while ($row = $note_res->fetch_assoc()) {
$db_loc = $row['location'];
$tmp_loc = explode('-', $db_loc);
$location = $tmp_loc[0];
if ($loc - $location <= 1) {
if ($row['note']) {
$content = $row['note'] . "\n" . $content;
}
$note_sql = "UPDATE note SET note = '" . addslashes($content) . "' \n \t\t\tWHERE bookname LIKE '%" . $bname . "%' AND location LIKE '%" . $db_loc . "%'";
//var_dump($note_sql);
$nres = $db->query($note_sql);
}
}
} elseif ($type != $bookmark && $type != $bookmark_zh) {
$link = "INSERT INTO note (time, location, content, type, bookname, author) VALUES ('" . $time . "', '" . $loc . "', '" . $content . "', '" . $type . "', '" . $bname . "', '" . $author . "' )";
$res = $db->query($link);
}
break;
default:
break;
}
}
}
开发者ID:Alex-duzhichao,项目名称:KindleNote,代码行数:81,代码来源:func.php
示例15: irc_say
if ($spam != "") {
irc_say($sfp, $spam, $nick, $channel);
//echo("-SAID: ".trim($commands[3])."\n");
}
//hplay:file - Prehraje soubor
if (trim($commands[2]) == "hplay") {
if (is_file(trim($commands[3]))) {
$rfile = fopen(trim($commands[3]), "r");
} else {
fclose($rfile);
$rfile = "";
}
echo "-FILE: " . trim($commands[3]) . "\n";
}
if ($rfile != "") {
irc_say($sfp, fgetss($rfile), $nick, $channel);
}
//hhelp - vypise tuto napovedu
if (trim($commands[2]) == "hhelp") {
irc_say($sfp, "Ja jsem Harvester - vice info na: http://ircbot.wz.cz/", $nick, $channel);
/*
irc_say( $sfp, "Harvester - Posle vizitku", $nick, $channel );
irc_say( $sfp, "hhelp - vypise tuto napovedu", $nick, $channel );
irc_say( $sfp, "hsay:Message - Posle zpravu", $nick, $channel );
irc_say( $sfp, "hpsay:to:Message - Posle soukromou zpravu kanalu nebo osobe", $nick, $channel );
irc_say( $sfp, "hdo:Command - Posle serveru prikaz", $nick, $channel );
irc_say( $sfp, "hmove:Channel - Pripoji do kanalu / Zmeni aktivni kanal", $nick, $channel );
irc_say( $sfp, "/invite Harvester #channel - Pozve a pripoji bota do kanalu", $nick, $channel );
irc_say( $sfp, "hpart:Channel - Odpoji se z kanalu", $nick, $channel );
irc_say( $sfp, "hjoke - Posle \"nahodny\" vtip", $nick, $channel );
*/
开发者ID:Harvie,项目名称:Programs,代码行数:31,代码来源:irc_bot.php
示例16: proc_open_spell
/**
* @param string $sText
* @return mixed array with command output or false.
*/
function proc_open_spell($sText)
{
$descriptorspec = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
if ($this->debug) {
$spell_proc = proc_open($this->spell_command, $descriptorspec, $pipes);
} else {
$spell_proc = @proc_open($this->spell_command, $descriptorspec, $pipes);
}
if (!is_resource($spell_proc)) {
return $this->set_error(sprintf(_("Could not run the spellchecker command (%s)."), $this->spell_command));
}
if (!@fwrite($pipes[0], $sText)) {
$this->set_error(_("Error while writing to pipe."));
// close all three $pipes here.
for ($i = 0; $i <= 2; $i++) {
// disable all fclose error messages
@fclose($pipes[$i]);
}
return false;
}
fclose($pipes[0]);
$sqspell_output = array();
for ($i = 1; $i <= 2; $i++) {
while (!feof($pipes[$i])) {
array_push($sqspell_output, rtrim(fgetss($pipes[$i], 999), "\r\n"));
}
fclose($pipes[$i]);
}
if (proc_close($spell_proc)) {
$error = '';
foreach ($sqspell_output as $line) {
$error .= $line . "\n";
}
return $this->set_error($error);
} else {
return $sqspell_output;
}
}
开发者ID:teammember8,项目名称:roundcube,代码行数:42,代码来源:cmd_spell.php
示例17: header
<?php
header('content-type:text/html;charset=utf-8');
$filename = 'readme.txt';
// 打开文件句柄
$handle = fopen($filename, 'r');
while (!feof($handle)) {
echo trim(fgetss($handle)), '<br/>';
}
// 关闭文件句柄
fclose($handle);
开发者ID:denson7,项目名称:phpstudy,代码行数:11,代码来源:08_getFileText.php
示例18: getss
/**
* 获取一行内容,过滤html php标签
*
* @param string $file
* @param string $length
* @param string $allow_tags
* @return string
*/
public function getss($file, $length = null, $allow_tags = '')
{
return fgetss($this->handle($file), $length, $allow_tags);
}
开发者ID:Rgss,项目名称:imp,代码行数:12,代码来源:File.php
示例19: rtrim
$thumbdir = rtrim('photos/' . $requestedDir, '/');
$currentdir = GALLERY_ROOT . $thumbdir;
guardAgainstDirectoryTraversal($currentdir);
//-----------------------
// READ FILES AND FOLDERS
//-----------------------
$files = array();
$dirs = array();
$img_captions = array();
if (is_dir($currentdir) && ($handle = opendir($currentdir))) {
// 1. LOAD CAPTIONS
$caption_filename = "{$currentdir}/captions.txt";
if (is_readable($caption_filename)) {
$caption_handle = fopen($caption_filename, "rb");
while (!feof($caption_handle)) {
$caption_line = fgetss($caption_handle);
if (empty($caption_line)) {
continue;
}
list($img_file, $img_text) = explode('|', $caption_line);
$img_captions[$img_file] = trim($img_text);
}
fclose($caption_handle);
}
while (false !== ($file = readdir($handle)) && !in_array($file, $SkipObjects)) {
// 2. LOAD FOLDERS
if (is_dir($currentdir . "/" . $file)) {
if ($file != "." && $file != "..") {
checkpermissions($currentdir . "/" . $file);
// Check for correct file permission
// Set thumbnail to folder.jpg if found:
开发者ID:doc75,项目名称:MinigalNano,代码行数:31,代码来源:index.php
示例20: file_put_contents
file_put_contents($filename, $string_with_tags);
$file_handle = fopen($filename, $file_modes[$mode_counter]);
if (!$file_handle) {
echo "Error: failed to open file {$filename}!\n";
exit;
}
// rewind the file pointer to beginning of the file
var_dump(filesize($filename));
var_dump(rewind($file_handle));
var_dump(ftell($file_handle));
var_dump(feof($file_handle));
/* rewind the file and read the file line by line with allowable tags */
echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n";
rewind($file_handle);
$line = 1;
while (!feof($file_handle)) {
echo "-- Line {$line} --\n";
$line++;
var_dump(fgetss($file_handle, 80, "<test>, <html>, <?>"));
var_dump(ftell($file_handle));
// check the file pointer position
var_dump(feof($file_handle));
// check if eof reached
}
// close the file
fclose($file_handle);
// delete the file
delete_file($filename);
}
// end of for - mode_counter
echo "Done\n";
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:fgetss_variation2.php
注:本文中的fgetss函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论