本文整理汇总了PHP中file_Exists函数的典型用法代码示例。如果您正苦于以下问题:PHP file_Exists函数的具体用法?PHP file_Exists怎么用?PHP file_Exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了file_Exists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($envParams, $kmigpath, $integId)
{
foreach ($envParams as $k => $v) {
putenv($k . '=' . $v);
}
$container = array();
if (file_exists($kmigpath . '/phpmig.php')) {
$this->_hasPhpmig = true;
require $kmigpath . '/phpmig.php';
if (empty($container)) {
throw new Exception('invalid container, make sure the relevant phpmig.php file sets a $container variable');
}
$this->_container = $container;
$datafilename = KmsCi_Kmig_IntegrationHelper::getInstanceByIntegrationId($integId)->getKmigPhpmigDataFileName();
if (file_Exists($datafilename)) {
$this->_hasKmigData = true;
\Kmig\Helper\Phpmig\KmigAdapter::setContainerValuesFromDataFile($this->_container, $datafilename);
}
$this->_command = new KmsCi_Environment_PhpmigHelper_Command();
$this->_command->kmig_container = $this->_container;
$this->_allMigrations = $this->_command->kmig_getMigrations();
/** @var \Kmig\Helper\Phpmig\KmigAdapter $adapter */
$adapter = $this->_container['phpmig.adapter'];
$this->_allVersions = $adapter->fetchAll();
}
}
示例2: testFilePath
public function testFilePath()
{
$path = File::generateFilepath('activemongo');
$this->assertTrue(file_Exists($path));
$this->assertTrue(preg_match("@" . DIRECTORY_SEPARATOR . "activemongo" . DIRECTORY_SEPARATOR . "@", $path) > 0);
$this->assertTrue(is_writable($path));
$this->assertEquals($path, File::generateFilepath('activemongo'));
$this->assertNotEquals($path, File::generateFilepath('activemongo', 'mongo://'));
}
示例3: __autoload
function __autoload($class)
{
if (file_Exists($file = rm_class2file($class))) {
require_once $file;
} else {
echo "<PRE>";
debug_print_backtrace();
echo "</PRE>";
}
}
示例4: destroyImage
public function destroyImage(ProductImage $productImage, $id)
{
$image = $productImage->find($id);
if (file_Exists(public_path() . '/uploads/' . $image->id . '.' . $image->extension)) {
Storage::disk('public_local')->delete($image->id . '.' . $image->extension);
}
$product = $image->product;
$image->delete();
return redirect()->route('products.images', ['id' => $product->id]);
}
示例5: init
/**
* This ugly methods allows you to have a 'managed' catch-all html template system.
*/
function init($p1 = '', $p2 = '', $p3 = '', $p4 = '', $p5 = '', $p6 = '')
{
$parts = array($p1, $p2, $p3, $p4, $p5, $p6);
$dir = implode("/", $parts);
$path = pathinfo($dir);
$file = MAIN_DIR . "/content/" . $path['dirname'] . "/" . $path['filename'] . ".html";
if (file_Exists($file)) {
$content = file_get_contents($file);
return $content;
}
}
示例6: testCompile
public function testCompile()
{
define('file', __DIR__ . '/generated/' . __CLASS__ . '.php');
$gen = new Generator();
$this->assertFalse(file_Exists(file));
$gen->addDirectory(__DIR__ . '/input');
$gen->setOutput(file);
$gen->generate();
$this->assertTrue(file_Exists(file));
// add mockup cache class
require __DIR__ . "/input/cache_class.php";
}
示例7: testCompile
public function testCompile()
{
$gen = new Generator();
$file = __DIR__ . '/generated/' . __CLASS__ . '.php';
$this->assertFalse(file_Exists($file));
$gen->addDirectory(__DIR__ . '/input');
$gen->setNamespace(__CLASS__);
$gen->setOutput($file);
$gen->generate();
$this->assertTrue(file_Exists($file));
require $file;
// add mockup cache class
require __DIR__ . "/input/cache_class.php";
}
示例8: init
protected function init()
{
include_once "sfYaml/sfYaml.class.php";
define('R2T_TEMP_DIR', R2T_PROJECT_DIR . "/tmp/");
if (!file_Exists(R2T_TEMP_DIR)) {
if (!mkdir(R2T_TEMP_DIR)) {
die("Could not create " . R2T_TEMP_DIR);
}
}
$yaml = file_get_contents(R2T_PROJECT_DIR . '/conf/defaults.yml');
$yaml .= file_get_contents(R2T_PROJECT_DIR . '/conf/feeds.yml');
$f = sfYAML::Load($yaml);
if ($f['feeds']) {
$this->feeds = $f['feeds'];
}
$this->defaults = $f['defaults'];
}
示例9: doJSONArrayDecode
function doJSONArrayDecode($string)
{
$result = array();
if (function_exists("json_decode")) {
try {
$result = json_decode($string);
} catch (Exception $e) {
$result = null;
}
} elseif (file_Exists("json.php")) {
require_once 'json.php';
$json = new Services_JSON();
$result = $json->decode($string);
if (!is_array($result)) {
$result = array();
}
}
return $result;
}
示例10: factory
/**
* Create a new Hyphenator-Object for a certain locale
*
* To determine the storage of the dictionaries we either use the set
* default configuration-file or we take the provided file and set the
* home-path from the information within that file.
*
* @param string $path The path to the configuration-file to use
* @param string $locale The locale to be used
*
* @return Hyphenator
*/
public static function factory($path = null, $locale = null)
{
$hyphenator = new Hyphenator();
if (null !== $path && file_Exists($path)) {
$hyphenator->setHomePath($path);
}
if (null !== $locale) {
$hyphenator->getOptions()->setDefaultLocale($locale);
}
return $hyphenator;
}
示例11: testCompile
public function testCompile()
{
$file = __DIR__ . '/generated/' . __CLASS__ . '.php';
define('xfile', $file);
$router = new Dispatcher\Router($file);
$router->addFile(__FILE__)->setNamespace(__CLASS__);
$this->assertFalse(file_Exists($file));
$router->load();
$this->assertTrue(file_Exists($file));
}
示例12: dirname
<?php
if (!file_Exists(dirname(__FILE__) . '/inc.var.php')) {
echo "to run ownStaGram follow these few steps:<br/><br/>";
echo "1) create a new database and set user permissions.<br/><br/>";
echo "2) rename <i>inc.var.php.dist</i> to <i>inc.var.php</i> and set database-credentials.<br/><br/>";
echo "3) change line <i>define('ownStaGramAdmin', 'mailSender@example.com');</i> to your prefered email-address.<br/><br/>";
echo "4) make data-folder writable for apache/php.<br/><br/>";
echo "5) reload this page and register with the emailaddress you set as ownStaGramAdmin.<br/><br/>";
exit;
}
define('projectPath', dirname(__FILE__));
include_once 'resources/inc.common.php';
error_reporting(-1);
if (!defined('DEBUGMODE') || !DEBUGMODE) {
ini_set('display_errors', 'off');
//Debugmode disabled
} else {
ini_set('display_errors', 'on');
//Debugmode enabled
}
if (isset($_GET['O'])) {
$_REQUEST["action"] = $_GET["action"] = "detail";
$_REQUEST["id"] = $_GET["id"] = $_GET["O"];
}
$settings = $own->getSettings();
$tpl = new template();
$tpl->setVariable($settings);
$tplContent = new template();
$tplContent->setVariable($settings);
if (isset($_GET['id'])) {
示例13: array
include_once "code/userscript.php";
include_once "code/url/url_to_absolute.php";
include_once "code/apk/ApkParser.php";
$response = array();
$build = $_REQUEST['build'];
$mobile = isset($_REQUEST['mobile']) && $_REQUEST['mobile'];
$details = array('jonatkins' => array('path' => 'release', 'name' => 'Stable release build', 'web' => 'http://iitc.jonatkins.com/?page=download', 'mobileweb' => 'http://iitc.jonatkins.com/?page=mobile'), 'jonatkins-test' => array('path' => 'test', 'name' => 'Test build', 'web' => 'http://iitc.jonatkins.com/?page=test', 'mobileweb' => 'http://iitc.jonatkins.com/?page=test#test-mobile'), 'jonatkins-experimental' => array('path' => 'experimental', 'name' => 'Experimental build', 'web' => 'http://iitc.jonatkins.com/?page=test&build=experimental', 'mobileweb' => 'http://iitc.jonatkins.com/?page=test&build=experimental#test-mobile'), 'jonatkins-dev' => array('path' => 'dev', 'name' => 'Development builds - not for public use', 'web' => 'http://iitc.jonatkins.com/?page=test&build=dev', 'mobileweb' => 'http://iitc.jonatkins.com/?page=test&build=dev#test-mobile'), 'local' => array('path' => NULL, 'name' => 'Local build - no update check available'));
if (array_key_exists($build, $details)) {
$info = $details[$build];
$pageurl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? "https" : "http") . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$response['name'] = $info['name'];
$dir = $info['path'];
if ($mobile) {
$apkfile = $dir . '/IITC_Mobile-' . $dir . '.apk';
if (file_Exists($apkfile)) {
$apkinfo = new ApkParser($apkfile);
$manifest = $apkinfo->getManifest();
$response['mobile'] = array('versionstr' => $manifest->getVersionName(), 'versioncode' => $manifest->getVersionCode(), 'downloadurl' => url_to_absolute($pageurl, $apkfile), 'pageurl' => $info['mobileweb']);
$archive = $apkinfo->getApkArchive();
$stream = $archive->getStream("assets/total-conversion-build.user.js");
if ($stream) {
$header = loadUserScriptHeader($stream);
$response['mobile']['iitc_version'] = $header['@version'];
}
} else {
$response['error'] = 'Failed to find .apk file ' . $apkfile;
}
} else {
// desktop - .user.js scripts
// load main script version
示例14: unlinkOld
public function unlinkOld()
{
$G = glob(projectPath . '/data/cache/*.jpg');
for ($i = 0; $i < count($G); $i++) {
if (filemtime($G[$i]) < time() - 60 * 60 * 24 * 30) {
if (file_Exists($G[$i]) && is_file($G[$i])) {
unlink($G[$i]);
}
}
}
}
示例15: authenticate
include 'Items.php';
// Them we instantiate the server
// Using the rewrite rule on .htaccess file the request url is passed into $_GET['q']
// Therefore we pass this parameter to restserver
// If app is running on root and .htacces working, them restserver can guess the url
$server = new Rest\Server($_GET["q"]);
// The server handles proper mime-types, * is for no extension
$server->setAccept(array("*", "application/json"));
// Using the "setParameter" we can have some globaly available vars
// This var will be accessible to all requests handlers
// Here I define a salt for the user authentication
$server->setParameter("salt", "&dcalsd-09o");
// Since this is just a demo I don't want to get much into
// Logic and stuff, so I'm creating a database on sqlite on
// the fly just to run something
$create = !file_Exists("data.db");
if ($create) {
touch("data.db");
}
$db = new PDO("sqlite:data.db");
if ($create) {
$db->query(file_get_contents("schema.sql"));
}
// Again using the server to setup some global database
$server->setParameter("db", $db);
// This is a dummy authentication function receiving
// a server instance (exactly like the handlers will receive)
function authenticate($server)
{
// First we recover the global parameters
$db = $server->getParameter("db");