Ben bir dizi değeri döküm Eğer ok testi 1 ve 2 iş ince, ama çalışmıyor.
$file = '/test/file.xlsx';
echo "Original Permissions: ".substr(decoct(fileperms($file)),2)."<br />\n\r";
// test 1
$permission = 0775;
chmod($file,$permission);
clearstatcache();
echo "Test 1 Permissions: ".substr(decoct(fileperms($file)),2)."<br />\n\r";
// test 2
define("PERMISSION", 0775);
chmod($file,PERMISSION);
clearstatcache();
echo "Test 2 Permissions: ".substr(decoct(fileperms($file)),2)."<br />\n\r";
Çıktı:
Original Permissions: 1407<br />
Test 1 Permissions: 0775<br />
Test 2 Permissions: 0775<br />
Bu neden çalışmıyor?
// $ini_array['excel_file_info']['excel_file_permission']
// is in a ini file with the value set to 0775
if(isset($ini_array['excel_file_info']['excel_file_permission'])) {
$excel_file_permission = $ini_array['excel_file_info']['excel_file_permission'];
define("EXCEL_FILE_PERMISSION", $excel_file_permission);
} else {
$excel_file_permission = 0777;
define("EXCEL_FILE_PERMISSION", $excel_file_permission);
}
echo "Permissions Before chmod: ".substr(decoct(fileperms($file)),2)."<br />\n\r";
chmod($file,EXCEL_FILE_PERMISSION);
clearstatcache();
echo "Permissions After chmod: ".substr(decoct(fileperms($file)),2)."<br />\n\r";;
chmod($file,0755);
clearstatcache();
echo "Permissions Hard Coded chmod: ".substr(decoct(fileperms($file)),2)."<br />\n\r";;
Ben dosya izinleri için bu olsun:
// Before I chmod
Permissions Before chmod: 0644<br />
// Using the DEFINED CONSTANT w/ set value to 0775
Permissions After chmod: 1363<br />
// Hard Coded 0755
Permissions Hard Coded chmod: 0755<br />
EDIT:
// test 3
$permission = array('perm' => 0775);
chmod($file,$permission['perm']);
clearstatcache();
echo "Test 3 Permissions: ".substr(decoct(fileperms($file)),2)."<br />\n\r";
3 işi, ama yine de ana örneği test. UGH!
EDIT # 2:
Ben bunu bir dize var değişkenin türünü yankı zaman, sorunu buldum.
echo "Defined Excel File Permission: ".EXCEL_FILE_PERMISSION."\n\r";
echo "Defined Type: ".gettype(EXCEL_FILE_PERMISSION)."\n\r";
Defined Excel File Permission: 0775
Defined Type: string
Neden bu?