我已经检查了与这个问题相关的每个答案,但它没有用。
我想在页脚中添加页码,我已经尝试过下面的代码,但没有奏效。谁能告诉我我哪里出错了?
$dompdf = new Dompdf();
$dompdf->set_option("isPhpEnabled", true);
$html_content = "
<html>
<head>
<style>
@font-face {
font-family: kindergarten;
font-weight: normal;
font-style: normal;
src: url('fonts/kindergarten.ttf') format('truetype');
}
.test{ font-family: kindergarten; }
</style>
</head>
<body>
<script type='text/php'>
if ( isset($pdf) ) {
$pdf->page_script('
$font = $fontMetrics->get_font('Arial, Helvetica, sans-serif, 'normal');
$size = 12;
$pageText = 'Page 1';
$y = 15;
$x = 520;
$pdf->text($x, $y, $pageText, $font, $size);
');
}
</script>
<div>My Content goes here</div>
</body>
</html>
";
//echo $html_content; die;
$dompdf->loadHtml($html_content);
$dompdf->render();
Run Code Online (Sandbox Code Playgroud) 我有类别和子类别。我有这种类型的数组。
谁能帮助我如何循环遍历n层。
Array
(
[0] => Array
(
[question_title] => hello.
[id] => 1
[step] => 1
[Children] => Array
(
)
)
[1] => Array
(
[question_title] => bye
[id] => 2
[step] => 1
[Children] => Array
(
)
)
[2] => Array
(
[question_title] => gtg
[id] => 3
[step] => 1
[Children] => Array
(
)
)
[3] => Array
(
[question_title] => cya
[id] => 4
[step] => 1
[Children] => Array
(
)
) …Run Code Online (Sandbox Code Playgroud) 我有一个特定的字符串
$email = "jaymin+1@gmail.com";
Run Code Online (Sandbox Code Playgroud)
我要清理并从字符串中删除+1,它也可以是任何数字+1或+99,因此最终字符串可以是
$email = "jaymin@gmail.com";
Run Code Online (Sandbox Code Playgroud)
我不知道该怎么办,我尝试创建此方法,但它给了我这个输出。
$email = jaymingmail.com;
Run Code Online (Sandbox Code Playgroud)
下面是我的功能:
public function delete_all_between($beginning, $end, $string) {
$beginningPos = strpos($string, $beginning);
$endPos = strpos($string, $end);
if ($beginningPos === false || $endPos === false) {
return $string;
}
$textToDelete = substr($string, $beginningPos, ($endPos + strlen($end)) - $beginningPos);
return $this->delete_all_between($beginning, $end, str_replace($textToDelete, '', $string)); // recursion to ensure all occurrences are replaced
}
$out = $this->delete_all_between('+', '@', $email);
Run Code Online (Sandbox Code Playgroud)
谁能帮我解决我要去的地方。
我需要删除+1或+号后的任何数字。