빈 페이지로 실행 중입니다. 모든 오류를보고하도록 PHP에 요청했지만 아직 구문 오류가 있다고 생각하는 부분이 없습니다. 나는 그것이 무엇인지 알 수 없다. 여기 PHP : 빈 페이지, 오류보고 기능이 작동하지 않습니다.
나는 스크립트를 일하고있다 :test.php
<?php
ini_set('display_errors', '1');
require('database.php');
print("hello");
$config = new Config("lessons.db","data/");
$db = new Database($config, array('first', 'second', 'third', 'fourth'), true);
print_r($db->dumpToArray());
?>
database.php
<?php
class Config {
private
$_db
$_file,
$_directory,
$_delimiter,
$_columns;
public function __construct(string $file, string $directory = null, string $delimiter = "|") {
$_db = $directory.$file;
$_directory = $directory;
$_delimiter = $delimiter;
}
public function db() {
return $_db;
}
public function delimiter() {
return $_delimiter;
}
}
class Database {
private
$_config,
$_columns,
$_rows,
$_pointer;
public function __construct(Config $config, array $constants = null, boolean $caseInsensitive = false) {
$_config = $config;
is_readable ($_config->db())
or exit ("The database cannot be read");
if(!is_null($constants))
$this->defineColumns($constants, $caseInsensitive);
return;
}
private function connect(string $method) {
if (!($_pointer = @fopen($_config->db(), $method)) or printf("Unable to connect to database");
}
private function disconnect() {
fclose($_pointer);
}
private function defineColumns($constants, $caseInsensitive) {
for (var $i=0;$i<count($constants);$i++)
define($constants[i], $i, $caseInsensitive);
}
public function dumpToArray() {
$arrayDump = explode($_config->delimiter(), file($_config->db(), FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES));
return $arrayDump;
}
public function getRowByValue($column, $value) {
$this->connect('r');
$rowNumber = 0;
while (!feof($_Pointer)) {
$row = explode($_config->delimiter(), fgets($dbPointer, 1024));
if ($row[$column] == $value) {
$this->disconnect();
return $row;
}
$rowNumber++;
}
$this->disconnect();
return false;
}
}
?>
사람이 원인이 될 수 무엇을 볼 수 있습니까?
언뜻
아파치 로그를보세요 ... – Flukey
먼저 구문 문제가 아닌지 확인하기 위해'php -l '을 사용해 보겠습니다. –
hafichuk
@Flukey는 그들에게 접근 할 수 없다. 나는 이상한 기업체에있다. –