本文整理汇总了PHP中Conf::common方法的典型用法代码示例。如果您正苦于以下问题:PHP Conf::common方法的具体用法?PHP Conf::common怎么用?PHP Conf::common使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conf
的用法示例。
在下文中一共展示了Conf::common方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error_reporting
/**
* Created by Manu
* Date:
* Time:
*/
namespace fr\gilman\nj;
error_reporting(E_ALL);
ini_set("display_errors", 1);
$action = 'index';
if (!empty($_GET['page']) && preg_match('#^[a-zA-Z]+$#', $_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 'Admin';
}
if (!empty($_GET['action']) && preg_match('#^[a-zA-Z]+$#', $_GET['action'])) {
$action = $_GET['action'];
}
require_once dirname(__FILE__) . '/models/Conf.php';
Conf::initCommon(dirname(__FILE__) . '/common.ini');
Conf::initPath(dirname(__FILE__) . '/path.ini');
require_once Conf::common()['path']['commonClasses'] . '/bb/inc.php';
require_once Conf::common()['path']['commonClasses'] . '/menu/inc.php';
require_once Conf::common()['path']['commonClasses'] . '/carte/inc.php';
require_once Conf::common()['path']['commonClasses'] . '/rules/inc.php';
DbHandler::connect(Conf::common()['DB']['HOST'], Conf::common()['DB']['DB'], Conf::common()['DB']['USER'], Conf::common()['DB']['PASS']);
require_once 'controllers/' . $page . '.php';
$page = __NAMESPACE__ . '\\' . $page;
$controler = new $page(new Menu());
$controler->{$action}();
示例2: uploadImageRegles
public function uploadImageRegles()
{
$ret = array('uploaded' => 0, 'filename' => '', 'url' => '');
if (!isset($_FILES['upload'])) {
$ret['error'] = "Pas de fichier envoyé";
echo json_encode($ret);
return;
}
$tmp_name = $_FILES["upload"]["tmp_name"];
$segments = explode('.', $_FILES["upload"]["name"]);
$extension = $segments[count($segments) - 1];
$exts = array("gif", "jpeg", "jpg", "png");
if (!in_array($extension, $exts)) {
$ret['error'] = "Le fichier doit être dans les extensions suivantes : " . print_r($exts, true);
echo json_encode($ret);
return;
}
$newName = md5(time() . rand(1, 1000000)) . '.' . $extension;
$path = Conf::path()['includes']['uploadImagesRegles'] . '/' . $newName;
if (!move_uploaded_file($_FILES["upload"]["tmp_name"], $path)) {
$ret['error'] = "Impossible d'enregistrer le fichier. Vérifier les droits sur le serveur";
echo json_encode($ret);
return;
}
$ret['uploaded'] = 1;
$ret['filename'] = $newName;
$ret['url'] = Conf::common()['urlAdmin']['images'] . '/' . Conf::path()['includes']['uploadImagesReglesURLRelative'] . '/' . $newName;
echo json_encode($ret);
}