class Needed_Cssjs{ public $tmpFile ; //值应该是$needed_cssjs_array[i][0]
public function doSetFile($strFile){ if ($strFile){ $this->tmpFile = $strFile } } public function doParse(){ if (!$strFile){ return; } if (!is_file('/test/' . $strFile)){ copy('/temp/' . $strFile , '/test/' . $strFile ); } } }
class Needed_Cssjs{
public $name ; //值应该是$needed_cssjs_array[i][0]
function copy(){
if(!file_exists('test/'.$this->name)){
copy($this->name,'test/'.$this->name);
}
}
}$hello=new Needed_Cssjs;
$hello->name=$needed_cssjs_array[i][0];
$hello->copy();
<?php
// $needed_cssjs_array 其实是post过来的。
$needed_cssjs_array= array();
$needed_cssjs_array[0]= array("main.css","css/main.css");
$needed_cssjs_array[1]= array("menu.css","css/menu_bg/menu.css");
$needed_cssjs_array[2]= array("tab.css","css/tab_bg/tab.css");
$needed_cssjs_array[3]= array("jquery.js","js/jquery.js");
//判断 test文件夹下是否有 $needed_cssjs_array 中的文件
// 比如 $needed_cssjs_array[0][1]
//如果没有就复制到test文件夹下。
//请问用定义对象属性方法的方法怎么设计?
class Needed_Cssjs{
public $tmpFile ; //值应该是$needed_cssjs_array[i][0]
public function doSetFile($strFile){ if ($strFile){ $this->tmpFile = $strFile } }
public function doParse(){
if (!$strFile){ return; }
if (!is_file('/test/' . $strFile)){ copy('/temp/' . $strFile , '/test/' . $strFile ); }
}
}
$hello=new Needed_Cssjs;
$hello->doParse();
?>