用于Laravel 5的DOMPDF包装器,它是用于laravel 5的html到pdf转换器.
我试图将laravel默认auth注册页面转换为PDF,路径为http://www.careertag.dev/auth/register.用于此目的的代码如下.但是我遇到了字体问题.你能帮我解决这个问题吗?
routes.php文件
Route::post('/screenshot', function(){
$pdf = App::make('dompdf.wrapper');
//$pdf->loadHTML('<h1>Test</h1>');
$view = View::make('auth.register')->render();
$pdf->loadHTML($view);
$pdf->stream();
//return $pdf->stream('invoice');
return $pdf->download('profile.pdf');
});
Run Code Online (Sandbox Code Playgroud)
错误
ErrorException in font_metrics.cls.php line 343: file_put_contents(C:\xampp\htdocs\careertag\storage\fonts/13350985545a9988387f8a573f409063.ttf): failed to open stream: No such file or directory
Run Code Online (Sandbox Code Playgroud) 我有这种形式的约会 - - 20160428000000
(2016年4月28日)即yyyymmdd ...
我需要的是,如果某些日子(例如3)被添加到这个日期 - 它应该添加它们但不超过月份(04) - 预期产量 - 20160430000000
- 4月30日
同样,20160226000000
+ 5天应该返回,20160229000000
即闰年2月.这意味着,它不应该跳到另一个月.
任何提示/想法?
我正在聊天网站上运行php套接字服务器(使用标准php套接字,基于来自https://github.com/sanwebe/Chat-Using-WebSocket-and-PHP-Socket/blob/master/server的脚本,使用标准php套接字。 php)一切正常,但我想做一些额外的操作,不确定如何完成(如果可以的话)
所以问题是:
我可以对尝试连接到Websocket的用户进行身份验证,而无需实际创建连接,然后通过套接字消息发送登录/身份验证信息吗?
我如何识别联网的对等方(知道哪个用户正在连接到哪个套接字),而无需他们通过套接字消息发送一些信息。
我能否仅将消息发送到连接到Websocket服务器的特定对等方(这是一个主要问题)?
谢谢
到目前为止,我们一直在使用PHP 5.5,所有代码似乎都流得太好了.由于将其升级为7,因此大多数foreach()似乎都具有不一致的行为.
例如:考虑下面的代码:
$array = array('a', 'b', 'c');
self::testForeach($array);
.
.
.
// $array is passed by reference
public static function testForeach(&$array) {
foreach ($array as $key => $val) {
//produces a, b as an output in PHP 5
//produces a, b, c as an output in PHP 7
var_dump($val);
if ($val == 'b') {
//remove 'c' from the array
unset($array[2]);
}
}
}
Run Code Online (Sandbox Code Playgroud)
PHP 5.5中的行为:
$ array通过引用传递给testForeach()函数.因此,从循环内的$数组中删除"c"将直接修改原始数组.因此,迭代值将是a,b而不是c,因为它从中间的数组中移除.
PHP 7中的行为:
$ array通过引用传递给testForeach()函数.当$ array循环遍历foreach()时,会产生一个副本,比如$ arrayCopy(根据doc),它正在循环中迭代.因此从$ array中删除"c"值将没有任何效果,并将循环$ arrayCopy中包含的所有值.因此输出 - a,b,c.
将foreach更改为pass-by-ref对我来说不是一个解决方案,因为我的项目中有太多的foreach并且我无法grep并修改它们中的每一个.
在最新版本上是否对此类行为进行了其他处理.任何可以突出显示它们的工具/解析器? …
我有一组复选框 -
<input id="check_1" name="check[1]" type="checkbox" value="1"/>
<label for="check_1">One</label>
<input id="check_2" name="check[2]" type="checkbox" value="1"/>
<label for="check_2">Two</label>
<input id="check_3" name="check[3]" type="checkbox" value="1"/>
<label for="check_3">Three</label>
Run Code Online (Sandbox Code Playgroud)
由于变量值id
和name
,我无法与标签复选框处理onclick事件One
.
我试过这个工作正常,但我不想使用,check_1
因为数字1是可变的,可以更改.
$("#check_1").change(function() {
alert('Checkbox One is clicked');
});
Run Code Online (Sandbox Code Playgroud)
我怎么做,因为我无权修改HTML?
这工作 -
$serialized = 'a:23:{s:6:"fields";a:5:{s:21:"display_name_creditor";s:1:"1";s:24:"display_name_constituent";s:1:"1";s:14:"email_creditor";s:1:"1";s:14:"phone_creditor";s:1:"1";s:12:"total_amount";s:1:"1";}s:5:"id_op";s:2:"in";s:8:"id_value";a:0:{}s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:1:{i:0;s:1:"1";}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:20:"Soft Credit details.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:21:"access CiviContribute";s:6:"groups";s:0:"";s:9:"domain_id";i:1;}';
Run Code Online (Sandbox Code Playgroud)
$ result = unserialize($ serialized);
这不 -
$serialized = 'a:23:{s:6:"fields";a:5:{s:21:"display_name_creditor";s:1:"1";s:24:"display_name_constituent";s:1:"1";s:14:"email_creditor";s:1:"1";s:14:"phone_creditor";s:1:"1";s:12:"amount";s:1:"1";}s:5:"id_op";s:2:"in";s:8:"id_value";a:0:{}s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:1:{i:0;s:1:"1";}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:20:"Soft Credit details.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:21:"access CiviContribute";s:6:"groups";s:0:"";s:9:"domain_id";i:1;}'
Run Code Online (Sandbox Code Playgroud)
我刚刚将total_amount
字段更改为amount
,我收到此错误 -
unserialize(): Error at offset 181 of 849 bytes
Run Code Online (Sandbox Code Playgroud)
我已经检查了unserialize()[function.unserialize]提供的解决方案:offset和http://davidwalsh.name/php-serialize-unserialize-issues的错误,但没有任何效果.
也试过用 base64_encode/decode before serialize/unserialize
任何提示?
如何正确选择然后将结果插入$ result?
$result = mysql_query("SELECT AVG(answervalue)
FROM `tblanswer`
WHERE questiontype = 'Methods'
AND studentid = '$username'
AND subjectname = '$server_subject'
AND professorname = '$server_name', $connect);
$Query = "INSERT INTO tblevaluationgrade (result) VALUES ('$result')";
Run Code Online (Sandbox Code Playgroud)