Anyone know PHP?
Aug. 3rd, 2006 07:59 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
I'm trying to convert a function from file_get_contents to GetContents.
There was a suggested code fix listed, but I'm not sure how to convert the code to work with the script I'm using. I've got the basics down, but there's additional functions listed there and I don't know how to place them.
Anyone out there that can help?
*hears crickets*
There was a suggested code fix listed, but I'm not sure how to convert the code to work with the script I'm using. I've got the basics down, but there's additional functions listed there and I don't know how to place them.
Anyone out there that can help?
*hears crickets*
no subject
Date: 2006-08-04 03:41 am (UTC)no subject
Date: 2006-08-04 03:54 am (UTC)Fatal error: Call to undefined function: file_get_contents()
That's referring to a specific line in the code:
if(file_exists(_BASEDIR."messages/tinymce.txt")) $tinymcesettings = file_get_contents(_BASEDIR."messages/tinymce.txt");
Someone suggested for different software to replace the function:
try adding the following function to the class library and changing the call to file_get_contents to call
GetContents instead.
function getContents( $filename )
{
if ( function_exists( 'file_get_contents' ) )
{
return file_get_contents( $filename );
}
else
{
$fp = fopen( $filename, 'r' );
if ( !$fp )
{
eZDebug::writeError( 'Could not read contents of ' . $filename, 'eZFile::getContents()' );
return false;
}
return fread( $fp, filesize( $filename ) );
}
}
Of course, I have no clue about any of that. I've seen other suggestions, like using something called "implode," and even some complicated library something-er-other replacements.
I'm befuddled...
no subject
Date: 2006-08-04 02:18 pm (UTC)So what happened when you added the replacement function? It looks OK (although EZDebug and EZFile also obviously need to be defined somewhere).
no subject
Date: 2006-08-04 02:37 pm (UTC)chickenofeathers@yahoo.com