Re: How can a php class read from a properties file?
am 11.01.2008 23:28:40 von Jerry Stuckle
Anthony Smith wrote:
> I have a class that calls some web services. I did not want the url of
> the web services to be hardcoded in the class. What is the best way to
> go about doing this?
>
Set the url as a property and initialize it via the constructor or a set
function (or give the ability to do both).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: How can a php class read from a properties file?
am 15.01.2008 14:45:11 von Rob
On Jan 11, 9:24=A0pm, Anthony Smith wrote:
> I have a class that calls some web services. I did not want the url of
> the web services to be hardcoded in the class. What is the best way to
> go about doing this?
Anthony, you could do this in a similar way to .Net, by using an
application configuration file.
The file can then be read in using parse_ini_file() -
http://uk.php.net/manual/en/function.parse-ini-file.php
The same thing is sometimes done by storing configuration details in a
database, and reading those in at runtime.
Rob.
Re: How can a php class read from a properties file?
am 15.01.2008 16:31:54 von mrsmithq
On Jan 15, 7:45 am, Rob wrote:
> On Jan 11, 9:24 pm,AnthonySmith wrote:
>
> > I have a class that calls some web services. I did not want the url of
> > the web services to be hardcoded in the class. What is the best way to
> > go about doing this?
>
> Anthony, you could do this in a similar way to .Net, by using an
> application configuration file.
>
> The file can then be read in using parse_ini_file() -http://uk.php.net/manual/en/function.parse-ini-file.php
>
> The same thing is sometimes done by storing configuration details in a
> database, and reading those in at runtime.
>
> Rob.
Thanks Rob. Exactly what I was looking for.