这有什么问题:
<?php echo '<div id="testID"> <p class="testClass">
<?php echo $textToPrint; ?> </p> </div>'; ?>
我尝试了innerHTML赋值,但它打印出一些乱码(放置一些额外的字符,而不仅仅是$ textToPrint中的字符,这是字符串php变量)。
这个完美无缺:
<?php echo '<h3>helloe</h3><br><p class="testClass">messing around</p>
<br>'; ?>
谢谢!
答案 0 :(得分:1)
你不需要两个回音就可以试试
<?php echo '<div id="testID"> <p class="testClass">' . $textToPrint .'</p> </div>'; ?>
答案 1 :(得分:0)
<?php echo '<div id="testID"> <p class="testClass">'; ?> #<--missing
<?php echo $textToPrint; ?> </p> </div> <!--remove-->
答案 2 :(得分:0)
你应该关闭php标签和引号:
<?php echo '<div id="testID"> <p class="testClass">'; ?>
<?php echo $textToPrint . '</p> </div>'; ?>
或者用完整的PHP中的一句话来说:
<?php echo '<div id="testID"><p class="testClass">'.$textToPrint.'</p></div>'; ?>
或者只用PHP中的php变量的html
<div id="testID"><p class="testClass"><?php echo $textToPrint;?></p></div>
答案 3 :(得分:0)
你可以尝试一下
$roleInstances = Get-AzureRole -ServiceName $cloudServiceName -Slot Production -InstanceDetails
Write-Output "Retrieved all role instances for cloud service: $cloudServiceName. Number of instances: " + $roleInstances.Count
# Group instances per update domain
$roleInstanceGroups = $roleInstances | Group-Object -AsHashTable -AsString -Property InstanceUpgradeDomain
Write-Output "Number of update domains found: " + $roleInstanceGroups.Keys.Count
# Visit each update domain
foreach ($key in $roleInstanceGroups.Keys)
{
$count = $perDomainInstances.Count;
Write-Output "Rebooting $count instances in domain $key"
$perDomainInstances = $roleInstanceGroups.Get_Item($key)
foreach -parallel($instance in $perDomainInstances)
{
$instanceName = $instance.InstanceName
Write-Output "Rebooting instance $instanceName"
Reset-AzureRoleInstance -ServiceName $cloudServiceName -Slot Production -InstanceName $instanceName -Reboot -ErrorAction Stop
}
}
祝你好运!