我自己的班级有问题。
FileHandler::getFileInfo($_FILES["datei"])
返回这个数组:
Array ( [tmp_name] => D:\xampp\tmp\phpD1C1.tmp [size] => 0.01 [type] => text/plain [error] => 0 [name] => witze.txt )
我想在“public function assignVariables()”中将“[error] => 0”分配给我的模板,但它不起作用。
我能做些什么来解决这个问题?
我的课:
<?php
// Imports von den Klassen die benötigt werden
require_once(INCLUDE_PATH . 'smarty/Smarty.class.php');
require_once(CLASS_PATH . 'database.class.php');
require_once(CLASS_PATH . 'FileHandler.class.php');
class IndexPage extends Smarty {
public $templateName = 'index.tpl';
public $query = null;
public $fileError = array();
public $sql = array();
public function __construct() {
parent::__construct();
$this->template_dir = TEMPLATE_PATH;
$this->compile_dir = COMPILE_DIR;
$this->config_dir = CONFIG_DIR;
$this->cache_dir = CACHE_DIR;
$this->assignVariables();
$this->returnInfos();
$this->showTemplate($this->templateName);
}
public function saveData() {
}
public function returnInfos() {
if(isset($_FILES["datei"])) {
$fileError = FileHandler::getFileInfo($_FILES["datei"]);
}
}
public function assignVariables() {
print_r($fileError);
echo $fileError["error"];
$this->fileError["error"];
self::assign(
array(
"array" => array(1,2,3,4),
"error" => $this->fileError["error"],
)
);
}
public function showTemplate($template) {
self::display($template);
}
}
?>