PHP class initialization, you can not use variable parameters, how to change it?

Source: Internet
Author: User
In the making of Gay Bay, and then ran into problems.

I just want to be used as a function is enough, the direct double quotation mark is not a problem, change the variable will not respond. Amount

$entxt =$_get["Entxt"];
Echo $entxt;
$x = new Fanyi ($entxt, 1);
echo $x->go ();
Class Fanyi
{


Reply to discussion (solution)

Direct double quotation marks are not a problem, but they do not respond to variables.
I don't understand.

Direct double quotation marks are not a problem, but they do not respond to variables.
I don't understand.
This can:

 
  Go (), class Fanyi{var $cilentID, Var $clientSecret, var $authUrl, var $scopeUrl, var $grantType; var $inputstring; var $ Tolanguage;var $fromLanguage; function __construct ($inputstring, $biao = ' 0 ') {


Not this one.
$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 ')
{

Direct double quotation marks are not a problem, but they do not respond to variables.
I don't understand.
Said the reverse, the above can not, the following May

New Fanyi ($entxt ;, 1);
More than a semicolon, resulting in grammatical errors can not be resolved, and you blocked the error prompt, so did not find this problem

Upstairs, with a semicolon.

  • 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.