在url参数中添加php var
问题描述:
Current URL is
<?php include ("/home/domain/public_html/create/dogs.php"); ?>
I want to do this:
<?php include ("/home/domain/public_html/create/<?php $partURL; ?>s.php"); ?>
$partURL is predefined. Just need to parse the php include within the above URL to parse correctly
当前网址是 p>
&lt;?php include(“ /home/domain/public_html/create/dogs.php“); ?&gt;
code> pre>
我想这样做: p>
&lt;?php include(“/ home / domain / public_html / create /&lt;?php $ partURL;?&gt; s.php“); ?&gt;
code> pre>
$ partURL已预定义。 只需要在上面的URL中解析php include来正确解析 p>
div>
答
You can do like this
<?php include ("/home/domain/public_html/create/{$partURL}s.php"); ?>
You can not use php tag with in a php tag like <?php <?php ?>?>
答
Read up on strings in PHP.
<?php include ("/home/domain/public_html/create/".$partURL."s.php"); ?>
答
You have to remove the PHP Tags from the "part URL" cause you are already in PHP.
<?php include ("/home/domain/public_html/create/" . $partURL . "s.php"); ?>