我正在学习C#,并且我正试图在使用课程时和不在时学习.
如果我正在为银行编写应用程序,我知道我会为客户使用类,其中包括他们的姓名,帐号,余额等.我会使用静态类来存入他们的帐户,撤销,更改的方法他们的地址等,因为我只需要写一次?
另外,我会用什么来跟踪每个客户对象?拥有2,000名客户:
exampleName = new Customer();
Run Code Online (Sandbox Code Playgroud)
在我的代码中似乎不对.我还没有学习数据库,我只是在学习课程.
我有一个目录结构如下:
/ files
/files/001
/files/001/addfile.php
/files/002
/files/002/deletefile.php
/files/003
/files/003/viewfile.php
我的剧本:
error_reporting(E_ALL);
$directory = 'files';
$files = scandir($directory);
$xml = new DOMDocument('1.0', 'UTF-8');
$xmlFiles = $xml->appendChild($xml->createElement('FILES'));
if(is_dir($directory)) {
print_r($files);
}
/*foreach($files as $file => $key) {
if($file == '.' || $file == '..') { continue; }
echo '$file: '.$file;
if(is_dir("$directory/$file")) {
$xmlDir->appendChild($xml->createElement($file));
}
else {
$xmlFiles->appendChild($xml->createElement('FILE', $file));
}
}*/
echo $xml->saveXML();
Run Code Online (Sandbox Code Playgroud)
我的问题:print_r($files)产出:
数组([0] =>.[1] => .. [2] => 001 [3] => 002 [4] => 003)
为什么scandir只输出目录而不是文件?
TIA,Nate