本文整理汇总了PHP中loadFile函数的典型用法代码示例。如果您正苦于以下问题:PHP loadFile函数的具体用法?PHP loadFile怎么用?PHP loadFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了loadFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseFile
function parseFile($download = false, $config)
{
$code = "";
$stylist = new phpStylist();
if (!isset($config->file) || $config->file == "") {
return false;
}
$code = loadFile($config->file);
if (isset($config->iso8859)) {
$code = utf8_encode($code);
}
if (!empty($code)) {
$stylist->options = $config;
if (isset($config->indent_with_tabs) && $config->indent_with_tabs) {
$stylist->indent_char = "\t";
}
if (!empty($config->indent_size)) {
$stylist->indent_size = $config->indent_size;
}
if (strpos($code, '<?') === false) {
$code = '<?php ' . $code . ' ?>';
}
$formatted = $stylist->formatCode($code);
}
return $formatted;
}
示例2: loadTemplate
private function loadTemplate()
{
if (is_file($this->_folderTemplate . '/index.html')) {
loadFile($this->_folderTemplate . '/index.html');
return true;
} else {
return false;
}
}
示例3: loadLib
/**
* Загрузить библиотеку
* @return bool Статус загрузки
* @exception Не найден класс/адаптер библиотеки
*/
private function loadLib()
{
if (loadFile($this->forlderLibrary . '/Adapter.php')) {
if (class_exists($this->nameLibrary)) {
return $this->{$this->nameLibrary} = new $this->nameLibrary();
}
return true;
}
return false;
}
示例4: __construct
public function __construct()
{
$tempEngineSelect = C('TEMPLATE_ENGINE');
if ("NoteEng" == $tempEngineSelect) {
$this->tempEngine = new Templates();
} else {
loadFile("notephp.Smarty.{$tempEngineSelect}");
$this->tempEngine = new Smarty();
}
$this->tempEngine->left_delimiter = C('SMARTY_LEFT_DELIMITER');
$this->tempEngine->right_delimiter = C('SMARTY_RIGHT_DELIMITER');
$this->tempEngine->cache_dir = PRO_PATH . "/" . ucfirst($GLOBALS['PROJECT_REQUEST_MODULE']) . "/Runtime/Cache";
$this->tempEngine->compile_dir = PRO_PATH . "/" . ucfirst($GLOBALS['PROJECT_REQUEST_MODULE']) . "/Runtime/Compile";
}
示例5: testCallbackFieldsInvalidResponse
function testCallbackFieldsInvalidResponse()
{
$client = new Zipmark_Client('wrong_identifier', 'wrong_secret');
$headerFile = loadFile('callback/headers_invalid.json');
$bodyFile = loadFile('callback/body.json');
// Headers should be an array
$headers = json_decode($headerFile[0], true);
// Body should be a JSON string
$body = $bodyFile[0];
$callback = new Zipmark_Callback($client, $headers, $body);
$this->assertFalse($callback->isValid());
$this->assertNull($callback->event());
$this->assertNull($callback->objectType());
$this->assertNull($callback->object());
}
示例6: exit
if (!defined('MAC_ROOT')) {
exit('Access Denied');
}
if ($method == 'vod') {
$tpl->P['cp'] = 'map';
$tpl->P['cn'] = $method . $tpl->P['id'];
echoPageCache($tpl->P['cp'], $tpl->P['cn']);
$db = new AppDb($MAC['db']['server'], $MAC['db']['user'], $MAC['db']['pass'], $MAC['db']['name']);
$sql = "SELECT * FROM {pre}vod WHERE d_hide=0 AND d_id=" . $tpl->P['id'];
$row = $db->getRow($sql);
if (!row) {
showErr('System', '未找到指定数据');
}
$tpl->T = $MAC_CACHE['vodtype'][$row['d_type']];
$tpl->D = $row;
unset($row);
$tpl->loadvod("rss");
$tpl->replaceVod();
$tpl->playdownlist("play");
$tpl->playdownlist("down");
} elseif ($method == 'rss' || $method == 'baidu' || $method == 'google' || $method == '360') {
$tpl->P['cp'] = 'map';
$tpl->P['cn'] = $method . '-' . $tpl->P['pg'];
echoPageCache($tpl->P['cp'], $tpl->P['cn']);
$db = new AppDb($MAC['db']['server'], $MAC['db']['user'], $MAC['db']['pass'], $MAC['db']['name']);
$tpl->H = loadFile(MAC_ROOT . '/inc/map/' . $method . '.html');
$tpl->mark();
} else {
showErr('System', '未找到指定系统模块');
}
示例7: loadFile
header('Content-Type: image/jpg');
$url = $_GET["url"];
}
function loadFile($sFilename, $sCharset = 'UTF-8')
{
if (floatval(phpversion()) >= 4.3) {
$sData = file_get_contents($sFilename);
} else {
if (!file_exists($sFilename)) return -3;
$rHandle = fopen($sFilename, 'r');
if (!$rHandle) return -2;
$sData = '';
while(!feof($rHandle))
$sData .= fread($rHandle, filesize($sFilename));
fclose($rHandle);
}
return $sData;
}
if( $url != "" )
{
echo loadFile($url, "auto");
}
else
{
echo "URL não definida";
}
?>
示例8: loadViewTemplate
public function loadViewTemplate($path)
{
return loadFile($path);
}
示例9: loadAndCompile
/**
* Loads a source code file and compiles it.
*
* @param string $sourceFile The filesystem path of the source code file.
* @param callable $compiler A function that transforms the source file into the final representation that will be
* cached. It must have a single parameter of type string (the source code).
* @return mixed
*/
function loadAndCompile($sourceFile, callable $compiler)
{
$sourceCode = loadFile($sourceFile, false);
if (!$sourceCode) {
$this->fileNotFound($sourceFile);
}
return $compiler($sourceCode);
}
示例10: var_dump
{
var_dump($_FILES);
if ($_FILES['donnees-file-to-import']['error'] != 0) {
return "Une erreur c'est produite durant le transfert";
}
if (is_uploaded_file($_FILES['donnees-file-to-import']['tmp_name']) === false) {
return "Un fichier est requis";
}
if (!move_uploaded_file($_FILES['donnees-file-to-import']['tmp_name'], FILE_FLIGHT_DATA)) {
return "Une erreur s'est produite durant la copie du fichier";
}
return TRUE;
}
$fileErr = "";
if (isset($_POST['submit'])) {
$message = loadFile();
if ($message === TRUE) {
header("Location: tableau_bord_post_vol.php");
} else {
$fileErr = $message;
}
}
?>
<!DOCTYPE html>
<html lang="fr-FR">
<head>
<title>Chargement des données</title>
<meta name="description"
content="Extrait les donnéesdu fichier généré par l'application embarqué">
<meta charset="UTF-8">
<meta name="author" content="Baptiste Thevenet">
开发者ID:maxitotogamer,项目名称:iutValence-projetS4-instrumentionFuseeAPoudre,代码行数:31,代码来源:chargement_donnees.php
示例11: exit
if (!defined('MAC_ROOT')) {
exit('Access Denied');
}
if ($MAC['other']['gbook'] == 0) {
echo 'gbook closed';
return;
}
if ($method == 'show') {
$tpl->C["siteaid"] = 30;
if ($tpl->P['pg'] < 1) {
$tpl->P['pg'] = 1;
}
$tpl->P['cp'] = 'app';
$tpl->P['cn'] = 'gbook' . $tpl->P['pg'];
//echoPageCache($tpl->P['cp'],$tpl->P['cn']);
$tpl->H = loadFile(MAC_ROOT . "/template/" . $MAC['site']['templatedir'] . "/" . $MAC['site']['htmldir'] . "/home_gbook.html");
$db = new AppDb($MAC['db']['server'], $MAC['db']['user'], $MAC['db']['pass'], $MAC['db']['name']);
$tpl->mark();
$tpl->H = str_replace("{maccms:gbookverify}", $MAC['other']['gbookverify'], $tpl->H);
if (strpos($tpl->H, '{maccms:count_gbook_all}')) {
$tpl->H = str_replace("{maccms:count_gbook_all}", $tpl->getDataCount('gbook', "all"), $tpl->H);
}
if (strpos($tpl->H, '{maccms:count_gbook_day}')) {
$tpl->H = str_replace("{maccms:count_gbook_day}", $tpl->getDataCount('gbook', "day"), $tpl->H);
}
$tpl->pageshow();
} elseif ($method == 'save') {
$g_vid = be("all", "g_vid");
$g_vid = chkSql($g_vid);
$g_name = be("all", "g_name");
$g_name = chkSql($g_name);
示例12: file_put_contents
// Move bash_complete_zkillboard to the bash_complete folder
try {
file_put_contents("/etc/bash_completion.d/zkillboard", file_get_contents("{$base}/bash_complete_zkillboard"));
exec("chmod +x {$base}/../cli.php");
} catch (Exception $ex) {
out("|r|Error! Couldn't move the bash_complete file into /etc/bash_completion.d/, please do this after the installer is done.");
}
// Now install the db structure
try {
$sqlFiles = scandir("{$base}/sql");
foreach ($sqlFiles as $file) {
if (Util::endsWith($file, ".sql")) {
$table = str_replace(".sql", "", $file);
out("Adding table |g|{$table}|n| ... ", false, false);
$sqlFile = "{$base}/sql/{$file}";
loadFile($sqlFile);
// Ensure the table starts with base parameters and doesn't inherit anything from zkillboard.com
if (!Util::startsWith($table, "ccp_")) {
Db::execute("truncate table {$table}");
}
out("|g|done");
}
}
} catch (Exception $ex) {
out("|r|Error! Removing configuration file.");
unlink($configLocation);
throw $ex;
}
try {
out("|g|Installing default admin user...");
// Install the default admin user
示例13: unset
if (is_array($classarr)) {
if (empty($tpl->P["key"])) {
$tpl->P["key"] = $classarr["c_name"];
}
$tpl->P["des"] = $tpl->P["des"] . " 剧情分类为" . $classarr["c_name"];
}
unset($classarr);
}
if (!empty($tpl->P["ids"])) {
$arr = explode(',', $tpl->P["ids"]);
for ($i = 0; $i < count($arr); $i++) {
$arr[$i] = intval($arr[$i]);
}
$tpl->P["ids"] = join(',', $arr);
}
$tpl->H = loadFile(MAC_ROOT_TEMPLATE . "/vod_search.html");
$tpl->mark();
$tpl->pageshow();
$colarr = array('{page:des}', '{page:key}', '{page:now}', '{page:order}', '{page:by}', '{page:wd}', '{page:wdencode}', '{page:pinyin}', '{page:letter}', '{page:year}', '{page:starring}', '{page:starringencode}', '{page:directed}', '{page:directedencode}', '{page:area}', '{page:areaencode}', '{page:lang}', '{page:langencode}', '{page:typeid}', '{page:typepid}', '{page:classid}');
$valarr = array($tpl->P["des"], $tpl->P["key"], $tpl->P["pg"], $tpl->P["order"], $tpl->P["by"], $tpl->P["wd"], urlencode($tpl->P["wd"]), $tpl->P["pinyin"], $tpl->P["letter"], $tpl->P['year'] == 0 ? '' : $tpl->P['year'], $tpl->P["starring"], urlencode($tpl->P["starring"]), $tpl->P["directed"], urlencode($tpl->P["directed"]), $tpl->P["area"], urlencode($tpl->P["area"]), $tpl->P["lang"], urlencode($tpl->P["lang"]), $tpl->P['typeid'], $tpl->P['typepid'], $tpl->P['classid']);
$tpl->H = str_replace($colarr, $valarr, $tpl->H);
unset($colarr, $valarr);
$linktype = $tpl->getLink('vod', 'search', '', array('typeid' => $tpl->P['typepid']));
$linkyear = $tpl->getLink('vod', 'search', '', array('year' => ''));
$linkletter = $tpl->getLink('vod', 'search', '', array('letter' => ''));
$linkarea = $tpl->getLink('vod', 'search', '', array('area' => ''));
$linklang = $tpl->getLink('vod', 'search', '', array('lang' => ''));
$linkclass = $tpl->getLink('vod', 'search', '', array('classid' => ''));
$linkorderasc = $tpl->getLink('vod', 'search', '', array('order' => 'asc'));
$linkorderdesc = $tpl->getLink('vod', 'search', '', array('order' => 'desc'));
$linkbytime = $tpl->getLink('vod', 'search', '', array('by' => 'time'));
示例14: loadFile
$iterator++;
}
}
$music_xml_text_en = loadFile('Amazon_product_reviews/music/music.en');
$music_array_xml_text_en = parseXMLString('text', $music_xml_text_en, false);
$iterator = 0;
foreach ($music_array_xml_text_en as $music_en) {
if (!empty($music_en)) {
writeFile('music_en/music_en' . $iterator . '.txt', $music_en);
$iterator++;
} else {
writeFile('music_en/music_en' . $iterator . '.txt', 'translation not available');
$iterator++;
}
}
$music_xml_text_fr = loadFile('Amazon_product_reviews/music/music.fr');
$music_array_xml_text_fr = parseXMLString('text', $music_xml_text_fr, false);
$iterator = 0;
foreach ($music_array_xml_text_fr as $music_fr) {
if (!empty($music_fr)) {
writeFile('music_fr/music_fr' . $iterator . '.txt', $music_fr);
$iterator++;
} else {
writeFile('music_en/music_fr' . $iterator . '.txt', 'translation not available');
$iterator++;
}
}
/* * ***********************
* FUNCTIONS
* *********************** */
/**
示例15: loadart
function loadart()
{
if ($this->P['make'] != true && chkCache($this->P['cp'], $this->P['cn'])) {
$this->H = getCache($this->P['cp'], $this->P['cn']);
} else {
$this->H = loadFile(MAC_ROOT_TEMPLATE . "/" . $this->T['t_tpl_art']);
$this->C["sitetid"] = $this->D['a_type'];
$this->C["siteid"] = $this->D['a_id'];
$this->P['arttypeid'] = $this->T['t_id'];
$this->P['arttypepid'] = $this->T['t_pid'];
$this->P['similar'] = array('name' => $this->D['a_name'], 'tag' => $this->D['a_tag']);
$GLOBALS['MAC_CACHE']['arttype'][$this->T['t_id']]['similar'] = 'no';
if ($this->P['make'] == true) {
if (strpos($this->H, 'similar=') > 0) {
$GLOBALS['MAC_CACHE']['arttype'][$this->T['t_id']]['similar'] = 'ok';
}
}
$this->mark();
$this->P['pageflag'] = 'art';
$this->P['pagetype'] = 'detail';
if ($this->P['make']) {
return;
}
$this->H = str_replace("[art:page]", $this->P["pg"], $this->H);
$arr = explode("[art:page]", $this->D["a_content"]);
$arrlen = count($arr);
if ($this->P['pg'] > $arrlen) {
$this->P['pg'] = $arrlen;
}
$this->P['content'] = $arr[$this->P["pg"] - 1];
$this->P['pagesize'] = 1;
$this->P['datacount'] = $arrlen;
$this->P['pagecount'] = $arrlen;
$this->pageshow();
unset($arr);
$this->replaceArt();
setCache($this->P['cp'], $this->P['cn'], $this->H);
}
}