|
Posted by Lendy Chen on 09/28/05 09:56
$sendmail_path = @ini_get('sendmail_path');
if (!$sendmail_path)
{
// no sendmail, so we're using SMTP to send mail
$delimiter = "\r\n";
}
else
{
$delimiter = "\n";
}
in vBulletin
2005/9/27, Silvio Porcellana <sporc@tin.it>:
> Jake Gardner wrote:
> > This is a stretch and I doubt you can do this very easily, but I was
> > wondering if there is a way to define behaviors that happen throughout
> > a script before execution for example if the OS is windows, all
> > strings are terminated with \r\n, if Linux, then \n without adding
> > addition ifs throughout the code.
> >
> I don't know if it may help you, but why don't you set a constant in a
> config file included by all your scripts to the CRLF value you want (if
> you want it dependant on the OS you can use http://php.net/php_uname)
> and then you append this constant to all your strings?
>
> Example:
>
> - config.inc.php:
> define('CRLF', ( strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? "\r\n" :
> "\n" ) );
>
> - other_script.php
> require_once 'config.inc.php';
> ....
> $string = 'Hi! My name is Pippo!' . CRLF;
>
>
> Or something like this... ;-)
>
> Cheers
> Silvio
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Lendy Chen
[Back to original message]
|