当前位置: 首页>>代码示例>>PHP>>正文


PHP feof函数代码示例

本文整理汇总了PHP中feof函数的典型用法代码示例。如果您正苦于以下问题:PHP feof函数的具体用法?PHP feof怎么用?PHP feof使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了feof函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _recaptcha_http_post

/**
 * Submits an HTTP POST to a reCAPTCHA server
 * @param string $host
 * @param string $path
 * @param array $data
 * @param int port
 * @return array response
 */
function _recaptcha_http_post($host, $path, $data, $port = 80)
{
    $req = _recaptcha_qsencode($data);
    $proxy_host = "proxy.iiit.ac.in";
    $proxy_port = "8080";
    $http_request = "POST http://{$host}{$path} HTTP/1.0\r\n";
    $http_request .= "Host: {$host}\r\n";
    $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
    $http_request .= "Content-Length: " . strlen($req) . "\r\n";
    $http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
    $http_request .= "\r\n";
    $http_request .= $req;
    $response = '';
    if (false == ($fs = @fsockopen($proxy_host, $proxy_port, $errno, $errstr, 10))) {
        die('Could not open socket aah');
    }
    fwrite($fs, $http_request);
    while (!feof($fs)) {
        $response .= fgets($fs, 1160);
    }
    // One TCP-IP packet
    fclose($fs);
    $response = explode("\r\n\r\n", $response, 2);
    return $response;
}
开发者ID:nehaljwani,项目名称:SSAD,代码行数:33,代码来源:recaptchaproxy.php

示例2: __construct

 /**
  * Constructor.
  *
  * @param Horde_Vcs_Base $rep  A repository object.
  * @param string $dn           Path to the directory.
  * @param array $opts          Any additional options:
  *
  * @throws Horde_Vcs_Exception
  */
 public function __construct(Horde_Vcs_Base $rep, $dn, $opts = array())
 {
     parent::__construct($rep, $dn, $opts);
     $cmd = $rep->getCommand() . ' ls ' . escapeshellarg($rep->sourceroot . $this->_dirName);
     $dir = proc_open($cmd, array(1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
     if (!$dir) {
         throw new Horde_Vcs_Exception('Failed to execute svn ls: ' . $cmd);
     }
     if ($error = stream_get_contents($pipes[2])) {
         proc_close($dir);
         throw new Horde_Vcs_Exception($error);
     }
     /* Create two arrays - one of all the files, and the other of all the
      * dirs. */
     $errors = array();
     while (!feof($pipes[1])) {
         $line = chop(fgets($pipes[1], 1024));
         if (!strlen($line)) {
             continue;
         }
         if (substr($line, 0, 4) == 'svn:') {
             $errors[] = $line;
         } elseif (substr($line, -1) == '/') {
             $this->_dirs[] = substr($line, 0, -1);
         } else {
             $this->_files[] = $rep->getFile($this->_dirName . '/' . $line);
         }
     }
     proc_close($dir);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:39,代码来源:Svn.php

示例3: compress

 public function compress($source, $type)
 {
     $cmd = sprintf('java -jar %s --type %s --charset UTF-8 --line-break 1000', escapeshellarg($this->yuiPath), $type);
     $process = proc_open($cmd, array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w")), $pipes);
     fwrite($pipes[0], $source);
     fclose($pipes[0]);
     $output = array("stdout" => "", "stderr" => "");
     $readSockets = array("stdout" => $pipes[1], "stderr" => $pipes[2]);
     $empty = array();
     while (false !== stream_select($readSockets, $empty, $empty, 1)) {
         foreach ($readSockets as $stream) {
             $output[$stream == $pipes[1] ? "stdout" : "stderr"] .= stream_get_contents($stream);
         }
         $readSockets = array("stdout" => $pipes[1], "stderr" => $pipes[2]);
         $eof = true;
         foreach ($readSockets as $stream) {
             $eof &= feof($stream);
         }
         if ($eof) {
             break;
         }
     }
     $compressed = $output['stdout'];
     $errors = $output['stderr'];
     $this->errors = "" !== $errors;
     if ($this->errors) {
         $compressed = "";
         $this->errors = sprintf("alert('compression errors, check your source and console for details'); console.error(%s); ", json_encode($errors));
     }
     proc_close($process);
     return $compressed;
 }
开发者ID:znanylekarz,项目名称:assets-loader,代码行数:32,代码来源:AssetsCompressor.php

示例4: downFile

 protected function downFile($path, $file_name)
 {
     header("Content-type:text/html;charset=utf-8");
     // echo $path,$file_name;
     //中文兼容
     $file_name = iconv("utf-8", "gb2312", $file_name);
     //获取网站根目录,这里可以换成你的下载目录
     $file_sub_path = $path;
     $file_path = $file_sub_path . $file_name;
     //判断文件是否存在
     if (!file_exists($file_path)) {
         echo '文件不存在';
         return;
     }
     $fp = fopen($file_path, "r");
     $file_size = filesize($file_path);
     //下载文件所需的header申明
     Header("Content-type: application/octet-stream");
     Header("Accept-Ranges: bytes");
     Header("Accept-Length:" . $file_size);
     Header("Content-Disposition: attachment; filename=" . $file_name);
     $buffer = 1024;
     $file_count = 0;
     //返回数据到浏览器
     while (!feof($fp) && $file_count < $file_size) {
         $file_con = fread($fp, $buffer);
         $file_count += $buffer;
         echo $file_con;
     }
     fclose($fp);
 }
开发者ID:leifuchen0111,项目名称:company,代码行数:31,代码来源:UpgradeController.class.php

示例5: sendMemcacheCommand

function sendMemcacheCommand($server, $port, $command)
{
    $s = @fsockopen($server, $port);
    if (!$s) {
        die("Cant connect to:" . $server . ':' . $port);
    }
    fwrite($s, $command . "\r\n");
    $buf = '';
    while (!feof($s)) {
        $buf .= fgets($s, 256);
        if (strpos($buf, "END\r\n") !== false) {
            // stat says end
            break;
        }
        if (strpos($buf, "DELETED\r\n") !== false || strpos($buf, "NOT_FOUND\r\n") !== false) {
            // delete says these
            break;
        }
        if (strpos($buf, "OK\r\n") !== false) {
            // flush_all says ok
            break;
        }
    }
    fclose($s);
    return parseMemcacheResults($buf);
}
开发者ID:hartum,项目名称:basezf,代码行数:26,代码来源:memcache.php

示例6: jyxo_bot

function jyxo_bot($q = "", $d = "mm", $ereg = ".", $notereg = "", $cnt = 10000000000000, $page = 1, $pmax = 2, $o = "nocls")
{
    $i = 0;
    $results = "";
    $results[$i] = "";
    //$q = str_replace(" ", "+", $q);
    $q = urlencode($q);
    for (; $page <= $pmax; $page++) {
        $request = "http://jyxo.cz/s?q={$q}&d={$d}&o={$o}&cnt={$cnt}&page={$page}";
        $fp = fopen($request, "r") or die("   !!! Cannot connect !!!");
        while (!feof($fp)) {
            $line = fgets($fp);
            if (eregi("<div class='r'>", $line) && ereg(" class=ri", $line)) {
                $line = explode("<!--m--><div class='r'><A HREF=\"", $line);
                $line = $line[1];
                $line = explode("\" class=ri", $line);
                $line = trim($line[0]);
                $line = urldecode($line);
                if (@eregi($ereg, $line) && !@eregi($notereg, $line) && !in_array($line, $results)) {
                    echo "{$line}\n";
                    //Output
                    //echo("$i:$line\n"); //Indexed Output
                    //echo("<a href=\"$line\">$line</a><br />\n"); //XHTML Output
                    $results[$i] = $line;
                    $i++;
                }
            }
        }
        fclose($fp);
    }
    echo "\nTotal: {$i}\n";
    //Sumary Output
    return $results;
}
开发者ID:Harvie,项目名称:Programs,代码行数:34,代码来源:jyxobot.php

示例7: test_instam

 function test_instam($key)
 {
     // returns array, or FALSE
     // snap(basename(__FILE__) . __LINE__, $key_val);
     // http://www.instamapper.com/api?action=getPositions&key=4899336036773934943
     $url = "http://www.instamapper.com/api?action=getPositions&key={$key}";
     $data = "";
     if (function_exists("curl_init")) {
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         $data = curl_exec($ch);
         curl_close($ch);
     } else {
         // not CURL
         if ($fp = @fopen($url, "r")) {
             while (!feof($fp) && strlen($data) < 9000) {
                 $data .= fgets($fp, 128);
             }
             fclose($fp);
         } else {
             //					print "-error 1";		// @fopen fails
             return FALSE;
         }
     }
     /*
     InstaMapper API v1.00
     1263013328977,bold,1236239763,34.07413,-118.34940,25.0,0.0,335
     1088203381874,CABOLD,1236255869,34.07701,-118.35262,27.0,0.4,72
     */
     //			dump($data);
     $ary_data = explode("\n", $data);
     return $ary_data;
 }
开发者ID:sharedgeo,项目名称:TicketsCAD-SharedGeo-Dev,代码行数:34,代码来源:test_instam.php

示例8: sendit

function sendit($param)
{
    $prefix = $_POST['prefix'];
    $data = $_POST['sql_text'];
    $host = $_POST['hostname'];
    $page = isset($_POST['dir']) ? '/' . $_POST['dir'] : '';
    $page .= '/modules.php?name=Search';
    $method = $_POST['method'];
    $ref_text = $_POST['ref_text'];
    $user_agent = $_POST['user_agent'];
    $result = '';
    $sock = fsockopen($host, 80, $errno, $errstr, 50);
    if (!$sock) {
        die("{$errstr} ({$errno})\n");
    }
    fputs($sock, "{$method} /{$page} HTTP/1.0\r\n");
    fputs($sock, "Host: {$host}" . "\r\n");
    fputs($sock, "Content-type: application/x-www-form-urlencoded\r\n");
    fputs($sock, "Content-length: " . strlen($data) . "\r\n");
    fputs($sock, "Referer: {$ref_text}" . "\r\n");
    fputs($sock, "User-Agent: {$user_agent}" . "\r\n");
    fputs($sock, "Accept: */*\r\n");
    fputs($sock, "\r\n");
    fputs($sock, "{$data}\r\n");
    fputs($sock, "\r\n");
    while (!feof($sock)) {
        $result .= fgets($sock, 8192);
    }
    fclose($sock);
    return $result;
}
开发者ID:SuperQcheng,项目名称:exploit-database,代码行数:31,代码来源:4965.php

示例9: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $filename = $input->getArgument('filename');
     if (!$filename) {
         if (0 !== ftell(STDIN)) {
             throw new \RuntimeException('Please provide a filename or pipe file content to STDIN.');
         }
         $content = '';
         while (!feof(STDIN)) {
             $content .= fread(STDIN, 1024);
         }
         return $this->display($input, $output, array($this->validate($content)));
     }
     if (0 !== strpos($filename, '@') && !is_readable($filename)) {
         throw new \RuntimeException(sprintf('File or directory "%s" is not readable', $filename));
     }
     $files = array();
     if (is_file($filename)) {
         $files = array($filename);
     } elseif (is_dir($filename)) {
         $files = Finder::create()->files()->in($filename)->name('*.yml');
     } else {
         $dir = $this->getApplication()->getKernel()->locateResource($filename);
         $files = Finder::create()->files()->in($dir)->name('*.yml');
     }
     $filesInfo = array();
     foreach ($files as $file) {
         $filesInfo[] = $this->validate(file_get_contents($file), $file);
     }
     return $this->display($input, $output, $filesInfo);
 }
开发者ID:brennantom,项目名称:hackazon,代码行数:31,代码来源:YamlLintCommand.php

示例10: Merge

function Merge($newtext,$oldtext,$pagetext) {
  global $WorkDir,$SysMergeCmd, $SysMergePassthru;
  SDV($SysMergeCmd,"/usr/bin/diff3 -L '' -L '' -L '' -m -E");
  if (substr($newtext,-1,1)!="\n") $newtext.="\n";
  if (substr($oldtext,-1,1)!="\n") $oldtext.="\n";
  if (substr($pagetext,-1,1)!="\n") $pagetext.="\n";
  $tempnew = tempnam($WorkDir,"new");
  $tempold = tempnam($WorkDir,"old");
  $temppag = tempnam($WorkDir,"page");
  if ($newfp=fopen($tempnew,'w')) { fputs($newfp,$newtext); fclose($newfp); }
  if ($oldfp=fopen($tempold,'w')) { fputs($oldfp,$oldtext); fclose($oldfp); }
  if ($pagfp=fopen($temppag,'w')) { fputs($pagfp,$pagetext); fclose($pagfp); }
  $mergetext = '';
  if (IsEnabled($SysMergePassthru, 0)) {
    ob_start();
    passthru("$SysMergeCmd $tempnew $tempold $temppag");
    $mergetext = ob_get_clean();
  }
  else {
    $merge_handle = popen("$SysMergeCmd $tempnew $tempold $temppag",'r');
    if ($merge_handle) {
      while (!feof($merge_handle)) $mergetext .= fread($merge_handle,4096);
      pclose($merge_handle);
    }
  }
  @unlink($tempnew); @unlink($tempold); @unlink($temppag);
  return $mergetext;
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:28,代码来源:simuledit.php

示例11: PostRequest

 function PostRequest($url, $referer, $_data, $addheader = null)
 {
     $data = null;
     while (list($n, $v) = each($_data)) {
         $data .= '&' . $n . '=' . rawurlencode($v);
     }
     $data = substr($data, 1);
     $url = parse_url($url);
     if ($url['scheme'] != 'http') {
         die("Only HTTP-Request are supported");
     }
     $host = $url['host'];
     $path = $url['path'];
     $fp = fsockopen($host, 80);
     fputs($fp, "POST {$path} HTTP/1.1\r\n");
     fputs($fp, "Host: {$host}\r\n");
     fputs($fp, "Referer: {$referer}\r\n");
     fputs($fp, "User-Agent: BotTool (http://testhh.pytalhost.com)\r\n");
     fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
     fputs($fp, "Content-length: " . strlen($data) . "\r\n");
     if ($addheader != '') {
         fputs($fp, $addheader);
     }
     fputs($fp, "Connection: close\r\n\r\n");
     fputs($fp, $data);
     $result = null;
     while (!feof($fp)) {
         $result .= fgets($fp, 128);
     }
     fclose($fp);
     $result = explode("\r\n\r\n", $result, 2);
     $header = isset($result[0]) ? $result[0] : '';
     $content = isset($result[1]) ? $result[1] : '';
     return array($header, $content);
 }
开发者ID:TFToto,项目名称:playjoom-builds,代码行数:35,代码来源:wiki.php

示例12: donateAction

 public function donateAction()
 {
     $this->setAccess('frontend/dashboard/access');
     // collect some data
     $data = [];
     exec('git-summary', $gitSummary);
     exec('git log -1 --format=%cd', $gitLastCommit);
     $key = 'git-time-extractor-file';
     $timeStatsFilePath = ROOT_PATH . '/../data/git/stats.csv';
     $this->getCache()->getItem($key, $success);
     if (!$success || !file_exists($timeStatsFilePath)) {
         exec('git_time_extractor > ' . $timeStatsFilePath);
         $this->getCache()->setItem($key, 'true');
     }
     if (isset($gitSummary[2]) && isset($gitSummary[4]) && isset($gitSummary[5])) {
         // summary
         $data['project_age'] = trim(str_replace('repo age : ', '', $gitSummary[2]));
         $data['total_commits*'] = trim(str_replace('commits  : ', '', $gitSummary[4]));
         $data['total_project_files'] = trim(str_replace('files    : ', '', $gitSummary[5]));
     } else {
         $data['project_age'] = '';
         $data['total_commits*'] = '';
         $data['total_project_files'] = '';
     }
     // changelog
     $data['last_commit'] = isset($gitLastCommit[0]) ? $gitLastCommit[0] : '';
     $stats = fopen($timeStatsFilePath, 'r');
     $x = 0;
     $changelog = [];
     $totalTime = 0;
     while (!feof($stats)) {
         $line = fgetcsv($stats, 1024, ',', '"');
         if ($x++ == 0 || count($line) <= 1) {
             continue;
         }
         $changes = explode('---', $line[8]);
         unset($changes[0]);
         $changelog[] = ['date' => $line[0], 'changes' => $changes];
         $totalTime += $line[3];
     }
     $userRepo = $this->getEntityManager()->getRepository('Auth\\Entity\\Benutzer');
     $squadRepo = $this->getEntityManager()->getRepository('Frontend\\Squads\\Entity\\Squad');
     $memberRepo = $this->getEntityManager()->getRepository('Frontend\\Squads\\Entity\\Member');
     // total user
     $data['registered_users'] = $userRepo->createQueryBuilder('c')->select('count(c.id)')->getQuery()->getSingleScalarResult();
     // total squads
     $data['total_squads'] = $squadRepo->createQueryBuilder('c')->select('count(c.id)')->getQuery()->getSingleScalarResult();
     // total squads
     $data['total_squad_members'] = $memberRepo->createQueryBuilder('c')->select('count(c.squad)')->getQuery()->getSingleScalarResult();
     // total images
     $data['total_squad_logos'] = $squadRepo->createQueryBuilder('c')->select('count(c.logo)')->where('c.logo IS NOT NULL')->andWhere("c.logo != ''")->getQuery()->getSingleScalarResult();
     // total image file size
     $data['total_squad_logos_size'] = $this->directoryFileSize(ROOT_PATH . '/uploads/logos/');
     $viewModel = new ViewModel();
     $viewModel->setTemplate('/dashboard/donate.phtml');
     $viewModel->setVariable('data', $data);
     $viewModel->setVariable('changelog', array_reverse($changelog));
     $viewModel->setVariable('total_time', $totalTime);
     return $viewModel;
 }
开发者ID:GlitchedMan,项目名称:armasquads,代码行数:60,代码来源:DashboardController.php

示例13: getfiles

 public function getfiles()
 {
     //检查文件是否存在
     if (file_exists($this->_filepath)) {
         //打开文件
         $file = fopen($this->_filepath, "r");
         //返回的文件类型
         Header("Content-type: application/octet-stream");
         //按照字节大小返回
         Header("Accept-Ranges: bytes");
         //返回文件的大小
         Header("Accept-Length: " . filesize($this->_filepath));
         //这里对客户端的弹出对话框,对应的文件名
         Header("Content-Disposition: attachment; filename=" . $this->_filename);
         //修改之前,一次性将数据传输给客户端
         echo fread($file, filesize($this->_filepath));
         //修改之后,一次只传输1024个字节的数据给客户端
         //向客户端回送数据
         $buffer = 1024;
         //
         //判断文件是否读完
         while (!feof($file)) {
             //将文件读入内存
             $file_data = fread($file, $buffer);
             //每次向客户端回送1024个字节的数据
             echo $file_data;
         }
         fclose($file);
     } else {
         echo "<script>alert('对不起,您要下载的文件不存在');</script>";
     }
 }
开发者ID:xupp,项目名称:ThinkPHP,代码行数:32,代码来源:download.class.php

示例14: find_xmpp

function find_xmpp($fp, $tag, $value = null, &$ret = null)
{
    static $val = null, $index = null;
    do {
        if ($val === null && $index === null) {
            list($val, $index) = recv_xml($fp);
            if ($val === null || $index === null) {
                return false;
            }
        }
        foreach ($index as $tag_key => $tag_array) {
            if ($tag_key === $tag) {
                if ($value === null) {
                    if (isset($val[$tag_array[0]]['value'])) {
                        $ret = $val[$tag_array[0]]['value'];
                    }
                    return true;
                }
                foreach ($tag_array as $i => $pos) {
                    if ($val[$pos]['tag'] === $tag && isset($val[$pos]['value']) && $val[$pos]['value'] === $value) {
                        $ret = $val[$pos]['value'];
                        return true;
                    }
                }
            }
        }
        $val = $index = null;
    } while (!feof($fp));
    return false;
}
开发者ID:NemOry,项目名称:NemSMSWebPanel,代码行数:30,代码来源:test.php

示例15: read

 public function read($fp, &$limit = PHP_INT_MAX)
 {
     $fp = ProtobufIO::toStream($fp, $limit);
     while (!feof($fp) && $limit > 0) {
         $tag = Protobuf::read_varint($fp, $limit);
         if ($tag === false) {
             break;
         }
         $wire = $tag & 0x7;
         $field = $tag >> 3;
         switch ($field) {
             case 1:
                 // optional string hash = 1
                 if ($wire !== 2) {
                     throw new \Exception("Incorrect wire format for field {$field}, expected: 2 got: {$wire}");
                 }
                 $len = Protobuf::read_varint($fp, $limit);
                 if ($len === false) {
                     throw new \Exception('Protobuf::read_varint returned false');
                 }
                 $tmp = Protobuf::read_bytes($fp, $len, $limit);
                 if ($tmp === false) {
                     throw new \Exception("read_bytes({$len}) returned false");
                 }
                 $this->hash = $tmp;
                 break;
             default:
                 $limit -= Protobuf::skip_field($fp, $wire);
         }
     }
 }
开发者ID:tuttarealstep,项目名称:pokegoapi-php,代码行数:31,代码来源:DownloadSettingsMessage.php


注:本文中的feof函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。