用于打印pdf的代码如下:
class MYPDF extends TCPDF {
// Load table data from file
public function LoadData($file) {
// Read file lines
$lines = file($file);
$data = array();
foreach($lines as $line) {
$data[] = explode(';', chop($line));
}
return $data;
}
// Colored table
public function ColoredTable($header,$data) {
// Colors, line width and bold font
$this->SetFillColor(233, 136, 64);
$this->SetTextColor(255);
$this->SetDrawColor(128, 0, 0);
$this->SetLineWidth(0.3);
$this->SetFont('', 'B');
// Header
$w = array(10, 40, 20, 20, 20, 20, 20);
$num_headers = count($header);
for($i = 0; $i …Run Code Online (Sandbox Code Playgroud) 以下是表格代码:
<table cellpadding="0" cellspacing="" width="100%" border="0">
<tbody>
<tr class="pack_list_divider">
<td width="30%" rowspan="2">
<img id="coursimg" src="test_listings_files/default_package_image.png" alt="Section wise test" border="0">
</td>
<td width="25%">
<p class="pckgvalidity">
Validity : 1 Year
</p>
</td>
<td width="35%">
<p class="pckgvalidity">Number of Tests : 0
</p>
</td>
<td width="20%" valign="middle">
<!--<p id="test_list_loader" height="20" align="center" style="display:none;"></p> -->
<a href="http://localhost/abc/pqr/lmn/web/online-test-packages?op=get_package_detail&test_pack_id=21e86b3ebf6a8af2a9fcf136c4f8e88a" class="view_test_package_details">Test Details</a>
</td>
</tr>
<tr>
<td colspan="2" width="50%" valign="top">
<p class="descp">
sectionm wise tests
</p>
</td>
<td width="20%">
<p class="pckgrs"> <span class="rs fl" style="color:#333333; font:25px bold; margin:0px 0px 10px …Run Code Online (Sandbox Code Playgroud)我正在使用tcpdf库生成pdf文档.我正在使用智能模板引擎来保存数据.下面是放入标题数据的脚本:
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, 'PQR',
'XYZ');
Run Code Online (Sandbox Code Playgroud)
我想将智能模板的HTML表格内容放在XYZ的位置,表格内容将是动态的(意味着表格中的数据可能因每个PDF文档而异).
我正在使用PHP,Smarty和TCPDF库来生成文档的PDF副本.该文档包含来自WIRIS编辑器的数学表达式图像以及文本内容.
我在定位表达图像旁边的文本时遇到问题.
我尝试了CSS float属性中的所有内容,但没有任何反应.我正在通过这封邮件附上我想要的屏幕截图.
这是打印问题及其选项的智能模板代码:
{foreach from=$question_data item=qstn_ans key=key}
<table border="0" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td valign="top" >{if $qstn_ans.question_directions}{$qstn_ans.question_directions}<br /><b>Question {$que_seq_no} : </b>{/if}{$qstn_ans.question_text}</td>
</tr>
{if $qstn_ans.question_file}
<tr>
<td><img src="{$ques_thum_image_path}{$qstn_ans.question_id}_{$qstn_ans.question_file}" /></td>
</tr>
{/if}
{if $qstn_ans.question_has_sub_ques==0}
{if $qstn_ans.answer}
{foreach from=$qstn_ans.answer item=ans key=ans_no}
<td valign="top" >
{if $ans.answer_is_right==1}{assign var='correct_ans' value=$ans_no+1}{/if}
<b>{$ans_no+1}.</b> {if $ans.answer_text!=''}{$ans.answer_text}{/if}
{if $ans.answer_file!=''}<img src="{$ans_thumb_img_path}{$ans.answer_id}_{$ans.answer_file}" />{/if}
</td>
</tr>
{/foreach}
<tr>
<td></td>
</tr>
</table>
{/foreach}
Run Code Online (Sandbox Code Playgroud)
此代码段可能包含一些错误,因为我随机粘贴它而不检查循环和括号完成,但这不是问题.
此代码中唯一重要的部分是打印问题文本的行和问号图像(如果存在).
我研究了正确的解决方案,但无法获得所需的解决方案.谁能帮我吗.
我有一个名为test_duration bigint(12)的数据列.我将时间以秒为单位存储到数据库中.现在,当我从表中获取记录时,我希望将时间转换为HH:MM:SS格式.我该怎么做到这一点?提前致谢.
我使用Slim框架开发了一些Web API.
我想对这些API实现"基于令牌的身份验证".由于这是我第一次使用"基于令牌的身份验证",所以对我来说一切都是新的.所以,我搜索了很多解决方案,并了解了'JSON Web Token(即JWT)'.
我访问了JWT的URL Git repo URL,但我无法理解如何使用PHP和MySQL将JWT实现到我的系统中.
我还在PHP和MySQL中搜索了使用'JSON Web Token(即JWT)'实现'基于令牌的身份验证'的工作示例.
如果有人可以提供完整的代码以及MySQL数据库表,与PHP的数据库连接,生成安全令牌,将令牌保存到相应的数据库表中,将安全令牌发送回调用PHP文件,在请求中发送安全令牌,使用存储在数据库中的安全令牌等来验证安全令牌,这对我来说真的非常有帮助.
如果可能,请以评论的形式提供整个代码,并提供正确的逐步说明.
实际上我正在使用插件SpryTabs来浏览菜单.我使用了两个背景图像来激活和停用标签.我在悬停时激活了一个标签.表示选项卡突出显示,并在单击其他选项卡时停用所选选项卡.
直到这里一切都很好.但真正的问题出现在用户在悬停后点击选项卡时,边框会在图像周围显示.
这在Firefox中不会发生,它只发生在Chrome和IE中.
我刚开始学习PHP,为了做到这一点,我在Windows 8.1上安装了wampserver.当我尝试启动时,它运行正常,但我有两个问题:
1)我的localhost页面有错误:
***错误***PHP配置加载文件是: - 应该是:C:/wamp64/bin/apache/apache2.4.17/bin/php.ini或c:/wamp64/bin/php/php5.6.16/ phpforapache.ini
我试图找到php.ini文件,但它不存在.在我的phpinfo()中,它是(无)在加载配置文件前面.
2)另一个问题是我无法访问phpmyadmin,我收到此错误:
"缺少mbstring扩展名.请检查您的PHP配置."
由于我是php的新手,请保持简单的答案!:)
提前致谢.
我有以下功能:
function mark_unmark_user_answer(targ, answer, answer_id, test_id, test_type, question_no, module_url) {
if(checked==targ){
targ.checked=false;
checked=false;
} else {
checked=targ;
}
$.post(module_url, {'test_id':test_id, 'question_no':question_no, 'op':'mark_ans', 'test_type':test_type, 'answer_no':answer, 'answer_id':answer_id}, function(data) {
if(jQuery.trim(data)=='unmark_ans') {
$('input[type="radio"]').removeAttr('checked');
$('#display_'+question_no).removeClass('green');
$('#display_'+question_no).removeClass('blue');
$('#display_'+question_no).addClass('orange');
} else {
//$('#mark_review').val('Mark');
$('#display_'+question_no).removeClass('orange');
$('#display_'+question_no).removeClass('blue');
$('#display_'+question_no).addClass("green");
$('#mark_review').attr('disabled', false);
}
var total_questions = $('#total_questions').val();
test_question_attempted_count( total_questions );
});
}
Run Code Online (Sandbox Code Playgroud)
我想为这个功能分配30秒的超时时间.因此,如果在30秒内未收到对ajax请求的响应,则应显示警告消息"您的Internet连接有问题".否则正常功能应该执行.
任何人都可以帮忙吗?
提前致谢.
我的表单上有简单的HTML文件控件.它本质上是动态的,意味着用户可以上传一个或多个文件.它的HTML如下:
<input type="file" id="image_book" class="image_book upload" name="image[]" accept="image/*" value=""/>
Run Code Online (Sandbox Code Playgroud)
如果我使用上面的HTML文件控件上传两个图像并提交表单,我会得到以下$_FILES数组(输出print_r($_FILES);):
Array
(
[image] => Array
(
[name] => Array
(
[0] => Aurbd-b3582991-large.jpg
[1] => BL_Miller_GD_Square_KV_300dpi_A2.jpg
)
[type] => Array
(
[0] => image/jpeg
[1] => image/jpeg
)
[tmp_name] => Array
(
[0] => /tmp/phpSt8CJJ
[1] => /tmp/phpibFjR2
)
[error] => Array
(
[0] => 0
[1] => 0
)
[size] => Array
(
[0] => 519179
[1] => 86901
)
)
)
Run Code Online (Sandbox Code Playgroud)
现在根据新的要求,我将使用Filepicker而不是简单的HTML文件控件来将文件上传到服务器.但我面临的问题是考虑到上面的数组($_FILES)内容,已经编写了进一步的代码逻辑和操作. …
php ×6
css ×3
html ×3
mysql ×3
tcpdf ×3
smarty ×2
ajax ×1
apache ×1
file-upload ×1
filepicker ×1
image ×1
javascript ×1
jquery ×1
jwt ×1
sql ×1
time ×1
timeout ×1
token ×1
wamp ×1
wampserver ×1