Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含“好”mime 类型列表的数组:
public $imageMimes = array('image/jpeg', 'image/png', 'image/gif', 'image/bmp', 'image/tiff');
我正在测试它:
if (in_array($this->data['PictureForm']['file']['type'], $imageMimes)) { ...}
当我打印针变量时,我得到图像/png,但不匹配?任何想法为什么?谢谢!
好像你需要不$this->imageMimes使用$videoMimes
$this->imageMimes
$videoMimes
所以你犯了两个错误:
您试图访问一个局部变量(不存在),而不是对象属性
你用错了名字