During PHP class initialization, can't variable parameters be used? how can this problem be solved? At Comrade Wan, I encountered a problem.
I just thought it would be enough to use a function. it would be okay to use double quotation marks directly, but it would not respond if I changed it to a variable. Amount
$ Entxt = $ _ GET ["entxt"];
Echo $ entxt;
$ X = new fanyi ($ entxt, 1 );
Echo $ x-> go ();
Class fanyi
{
Reply to discussion (solution)
There is no problem with double quotation marks directly, and it will not respond if it is changed to a variable.
Not understood
There is no problem with double quotation marks directly, and it will not respond if it is changed to a variable.
Not understood
This can be:
go();class fanyi{var $cilentID;var $clientSecret;var $authUrl;var $scopeUrl;var $grantType;var $inputstring;var $toLanguage;var $fromLanguage;function __construct($inputstring,$biao='0'){
This is not acceptable.
$ Entxt = $ _ GET ["entxt"];
Echo $ entxt;
$ X = new fanyi ("hello baby", 1 );
Echo $ x-> go ();
Class fanyi
{
Var $ cilentID;
Var $ clientSecret;
Var $ authUrl;
Var $ scopeUrl;
Var $ grantType;
Var $ inputstring;
Var $ toLanguage;
Var $ fromLanguage;
Function _ construct ($ inputstring, $ biao = '0 ')
{
There is no problem with double quotation marks directly, and it will not respond if it is changed to a variable.
Not understood
The opposite is true. the above is not acceptable. The following is acceptable.
New fanyi ($ entxt;, 1 );
If a semicolon is added, the syntax error cannot be parsed, and you have blocked the error prompt, so this problem cannot be found.
A semicolon is added to the same building.