Class > Opgelost

Gestart doorAllard2 reacties14 weergaven

3 berichten · pagina 1 van 1

Allard

Lid · Topicstarter

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

Ik heb even een vraag. Ik heb het onderstaande script. Maar hoe kan ik de functie GetCredentials opdelen? Dat als ik bijv. vraag GetCredentials($user), dat ik dan alleen de username terug krijg?

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]/**
 * This class holds the settings for the DirectAmin API
 */[/COLOR]
[URL="http://www.php.net/class"]class[/URL] DirectAdmin_Api
[COLOR= #007700]{           
        var[/COLOR] [COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"username"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// The username you log into DirectAdmin[/COLOR]
        [COLOR= #007700]var[/COLOR] [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"password"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// The password of your DirectAdmin account[/COLOR]
   
        [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] GetCredentials[COLOR= #007700]()
        {[/COLOR]
                  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]user[COLOR= #007700];[/COLOR]
                  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]pass[COLOR= #007700];
        }
}[/COLOR]

[COLOR= #0000BB]$obj[/COLOR] [COLOR= #007700]= new[/COLOR] DirectAdmin_Api[COLOR= #007700]();[/COLOR] 
[COLOR= #0000BB]$obj[/COLOR][COLOR= #007700]->[/COLOR]GetCredentials[COLOR= #007700]();[/COLOR] 
?>
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] getCredentials[COLOR= #007700]([/COLOR][COLOR= #0000BB]$wat[/COLOR][COLOR= #007700])
{[/COLOR]

    [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$wat[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]pass[/COLOR] [COLOR= #007700]?[/COLOR] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]pass [COLOR= #007700]:[/COLOR] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]user[COLOR= #007700];

}[/COLOR]


je kunt beter nooit met echo in je class werken smile
0
Berichten
707
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dat wist ik niet. Weeral iets bij geleerd!
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