Variabele ophalen > Niet opgelost

Gestart doorAllard3 reacties15 weergaven

4 berichten · pagina 1 van 1

Allard

Lid · Topicstarter

Berichten
970
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Beste,

Weet iemand misschien hoe ik de variabele kan ophalen. Ik vraag op $test. Maar er staat niks?

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/require_once"]require_once[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]ApiSettings.php[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #FF8000]/**
 * This class to show all domains by user id. You can choose the domain names to
 *  show in a list. But you can also choose to show the domains in a row.
 *  
 */[/COLOR]

[COLOR= #0000BB]$test[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"hoi"[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/class"]class[/URL] DirectAdmin_Domains
[COLOR= #007700]{[/COLOR]          
    [COLOR= #FF8000]/**
     * The default user id, for showing the domains
     *
     * @var string
     */[/COLOR]
    [COLOR= #007700]var[/COLOR] [COLOR= #0000BB]$userid[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR]

        [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] ShowDomains[COLOR= #007700]()
        {[/COLOR]
                  [COLOR= #FF8000]/**
                  * Make a connection with the api database
                  */[/COLOR]
                  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$test[/COLOR][COLOR= #007700];

         }
}[/COLOR]

[COLOR= #0000BB]$Domains[/COLOR] [COLOR= #007700]= new[/COLOR] DirectAdmin_Domains[COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$Domains[/COLOR][COLOR= #007700]->[/COLOR]ShowDomains[COLOR= #007700]();[/COLOR]
?>
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
In de public function ShowDomains() moet je global $test; zetten.

[COLOR= #0000BB]<?php[/COLOR]
        [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] ShowDomains[COLOR= #007700]()
        {[/COLOR]
[URL="http://www.php.net/global"]global[/URL] [COLOR= #0000BB]$test[/COLOR][COLOR= #007700];[/COLOR]
                  [COLOR= #FF8000]/**
                  * Make a connection with the api database
                  */[/COLOR]
                  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$test[/COLOR][COLOR= #007700];

         }[/COLOR]
?>
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Of je doet gewoon $this->test in plaats van $test.. Buiten dat moet je geen waardes echoen binnen classen, je moet ze returnen. Ander krijg je alleen maar slechte code.
0
Allard

Lid · Topicstarter

Berichten
970
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dank je.
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren