argument passing - Can't get PHP string variable to expand -
i define string variable this:
$menu = '../views/menus/documentation-menu.html';
later in script try use so:
$content = file_get_contents("{$menu}");
but when run script, warns me "warning: file_get_contents(): filename cannot empty in ".
if fact, i've tried sorts of combinations double quotes , single quotes , no braces, wrong. if put string in directly, works expected:
$content = file_get_contents("../views/menus/documentation-menu.html");
but want $menu argument file_get_contents, not hard-coded string.
i'm missing simple because don't know php ....
have tried $content = file_get_contents($menu);
?
that said, want manipulate file contents, or include in page? if latter, use include
or require
.
Comments
Post a Comment