PHP writing exception

Source: Internet
Author: User
Incorrect PHP syntax class & nbsp; Images {var & nbsp; $ inputName; & nbsp; & nbsp; & nbs PHP incorrect syntax

Class Images {
Var $ inputName; // control name
Var $ allowType = array (
'Image/GIF', 'image/jpg ', 'image/jpeg', 'image/png ', 'image/x-png', and 'image/pjpeg'
); // Upload type
Var $ allowSize = 2097152; // limit the size
Var $ saveDir = $ _ SERVER ['document _ root']. "/upfiles/user"; // Save the Directory
Var $ isRename = true; // whether to rename. the default value is true.
Var $ errID = 0; // error code. the default value is 0.
Var $ errMsg = ""; // error message
Var $ savePath = ""; // save path


Var $ saveDir = $ _ SERVER ['document _ root']. "/upfiles/user"; // Save the Directory
Is this write error? How should I write it?



Share:
------ Solution --------------------
The attribute cannot be an unknown value in the class definition.
You can assign values in the constructor.

Class Images {
Var $ saveDir;
Function Image (){
$ This-> saveDir = $ _ SERVER ['document _ root']. "/upfiles/user"; // Save the Directory
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.