我想創建不同的類,只有一個變量具有不同的值,其他所有元素都應該與父類相同。更改子類中的屬性php
這裏是父類
class parentClass {
private $param_name_saved = 'files';
protected $image_objects = array();
function __construct($options = null, $initialize = true, $error_messages = null) {
$this->options = array(
'script_url' => $this->get_full_url().'/',
'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/2',
'upload_url' => $this->get_full_url().'/files/2',
'user_dirs' => false,
'mkdir_mode' => 0755,
'param_name' => $this->param_name_saved,
'tost' => 'files',
// Set the following option to 'POST', if your server does not support
// DELETE requests. This is a parameter sent to the client:
'delete_type' => 'DELETE',
'access_control_allow_origin' => '*',
'access_control_allow_credentials' => false,
'access_control_allow_methods' => array(
'OPTIONS',
'HEAD',
'GET',
'POST',
'PUT',
'PATCH',
'DELETE'
)
}
}
我想與財產$不同的價值創造少兒班param_name_saved
這是我想創造
class childClassone extends parentClass {
private $param_name_saved = 'files3';
}
class childClasstwo extends parentClass {
private $param_name_saved = 'files2';
}
當我用什麼上面的代碼不是我在這裏做錯了什麼?
你可以讓'$ param_name_saved'保護呢? –