Description
This function saves a string to a file.
Warning:
Examples
Note:
Use cPanel's API Shell interface (Home >> Advanced >> API Shell) to directly test cPanel API calls.
Parameters
Parameter |
Type |
Description |
Possible values |
Example |
path |
string |
Required The new file's path. |
A valid absolute file path. |
/home/user |
filename |
string |
Required The new file's name. |
A valid file name. |
new_file.txt |
content |
string |
Required The new file's contents. |
A valid string. |
This is saved content. |
charset |
string |
The new file's character set. This parameter defaults to utf-8. Warning: We strongly recommend that you do not use this parameter. |
A valid character set. |
utf-32 |
Returns
Return |
Type |
Description |
Possible values |
Example |
charset |
string |
The file's character set. |
The charset input parameter's value. |
utf-8 |
path |
string |
The file's path. |
A valid absolute file path. |
/home/example/new_file |
reason |
string |
A reason for failure Note: This function only returns a reasonvalue if an error occurred. |
A string that describes the error. |
This is an error message. |
result |
Boolean |
Whether the function succeeded. |
|
1 |