Welcome! Log In Create A New Profile

Advanced

[PHP] Question about warning generated by script

Posted by Jeffry Killen 
Jeffry Killen
[PHP] Question about warning generated by script
March 24, 2017 06:20AM
Hello;
This script line is generating a warning, but It doesn't really say what the problem is.
The warning is "Warning: file_put_contents(<contents of the file truncated>&...)<path to script file and line number>"

Is this too much to put in one line like this?

file_put_contents(str_replace('_LAB_LABEL', '_'.strtoupper($_labName), file_get_contents(self::$_labTemplate)), $_labName."/index.php");

Thanks for time and attention;
JK
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Pete Ford
Re: [PHP] Question about warning generated by script
March 24, 2017 10:00AM
On 24/03/17 05:16, Jeffry Killen wrote:
> Hello;
> This script line is generating a warning, but It doesn't really say what the problem is.
> The warning is "Warning: file_put_contents(<contents of the file truncated>&...)<path to script file and line number>"
>
> Is this too much to put in one line like this?
>
> file_put_contents(str_replace('_LAB_LABEL', '_'.strtoupper($_labName), file_get_contents(self::$_labTemplate)), $_labName."/index.php");
>
> Thanks for time and attention;
> JK

You've got the parameters the wrong way around - filename should be first, and
then the content...

Cheers

Pete


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jeffry Killen
Re: [PHP] Question about warning generated by script
March 24, 2017 06:40PM
> On Mar 24, 2017, at 1:52 AM, Pete Ford <[email protected]> wrote:
>
> On 24/03/17 05:16, Jeffry Killen wrote:
>> Hello;
>> This script line is generating a warning, but It doesn't really say what the problem is.
>> The warning is "Warning: file_put_contents(<contents of the file truncated>&...)<path to script file and line number>"
>>
>> Is this too much to put in one line like this?
>>
>> file_put_contents(str_replace('_LAB_LABEL', '_'.strtoupper($_labName), file_get_contents(self::$_labTemplate)), $_labName."/index.php");
>>
>> Thanks for time and attention;
>> JK
>
> You've got the parameters the wrong way around - filename should be first, and then the content...
>
> Cheers
>
> Pete
>

Thank you, now it is working with revision you suggest.
JK
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Sorry, only registered users may post in this forum.

Click here to login