我在PHPExcel工作.我是初学者.当我使用以下代码并且工作正常时.
$phpExcel = new PHPExcel();
$phpExcel->getActiveSheet()->getStyle("A1")->getFont()->setBold(true)
->setName('Verdana')
->setSize(10)
->getColor()->setRGB('6F6F6F');
Run Code Online (Sandbox Code Playgroud)
但是,当我使用以下代码并且没有获得如上所述的预期结果时.
$phpFont = new PHPExcel_Style_Font();
$phpFont->setBold(true);
$phpFont->setName('Verdana');
$phpFont->setSize(15);
$phpColor = new PHPExcel_Style_Color();
$phpColor->setRGB('FF0000');
$phpExcel->getActiveSheet()->getStyle('A1')->setFont( $phpFont );
$phpExcel->getActiveSheet()->getStyle('A1')->getFont()->setColor( $phpColor );
Run Code Online (Sandbox Code Playgroud)
请帮助我在上面的代码中做错了什么.
先感谢您!
$arr = array(1);
$a = & $arr[0];
$arr2 = $arr;
$arr2[0]++;
echo $arr[0],$arr2[0];
// Output 2,2
Run Code Online (Sandbox Code Playgroud)
你能帮我一下,怎么可能?
我有一个带有两张表的excel文件:
Worksheet表中显示为列表项的项目列表.请看下面的图片:

我想用PHPExcel库生成这个.我试过但没有得到预期的结果.看下面的代码:
$objPHPExcel = new PHPExcel();
// Set document properties
$objPHPExcel->getProperties()->setCreator("Soumya Biswas")
->setLastModifiedBy("Soumya Biswas")
->setTitle("Office 2007 XLSX Test Document")
->setSubject("Office 2007 XLSX Test Document")
->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
->setKeywords("office 2007 openxml php")
->setCategory("Test result file");
// Create a first sheet
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->setCellValue('A5', "List");
// Set data validation
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B5')->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
$objValidation->setAllowBlank(false);
$objValidation->setShowInputMessage(true);
$objValidation->setShowErrorMessage(true);
$objValidation->setShowDropDown(true);
$objValidation->setErrorTitle('Input error');
$objValidation->setError('Value is …Run Code Online (Sandbox Code Playgroud) 我有以下PHP/HTML代码:
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$file_name = "../images/".$_FILES["file"]["name"];}
echo $file_name;
?>
<form name="updateArticle" method="post">
<div class="custom_file_upload">
<input type="text" class="file" name="file_info" id="file_info" disabled="disabled" value="<?php echo $image_name;?>">
<div class="file_upload">
<input type="file" id="file_upload" name="file" onchange="name_change()" id="file">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
这里的问题是我无法获得价值 $_FILES["file"]["name"]
为什么以及如何解决它?
我使用简单的MySQL代码从具有auto_increment id的表单插入数据,它在本地主机上工作正常,但在服务器上没有.
这是我正在使用的代码
$myvar=$_POST['var'];
//Insert data into mysql table
$sql="INSERT INTO mytable(id,myvar) VALUES ('','$myvar')";
Run Code Online (Sandbox Code Playgroud)
在本地主机phpmyadmin数据插入表但在服务器上phpmyadmin数据未插入表中.在我的localhost中,我XAMPP在IIS服务器上使用phpmyadmin.我应该在服务器上的phpmyadmin中做什么设置,以便自动插入id自动增加,我知道我可以mysql_insert_id()用来插入id但是在很多文件中我使用了这种类型的代码,我无法改变.我想要相同的设置XAMPP,可以轻松地采用这种类型的代码.
我需要的对象的信息"label","name"其中value=true在一个PHP变量,而不是为value=false.
这个JSON数组是如何完成的?
如果我做一个var_dump,JSON我得到这个:
array(8) {
[0]=>
object(stdClass)#8 (3) {
["label"]=>
string(4) "Name"
["name"]=>
string(7) "txtName"
["value"]=>
bool(true)
}
[1]=>
object(stdClass)#9 (3) {
["label"]=>
string(6) "E-mail"
["name"]=>
string(8) "txtEmail"
["value"]=>
bool(true)
}
[2]=>
object(stdClass)#10 (3) {
["label"]=>
string(12) "Phone Number"
["name"]=>
string(8) "txtPhone"
["value"]=>
bool(false)
}
[3]=>
object(stdClass)#11 (3) {
["label"]=>
string(19) "Mobile Phone Number"
["name"]=>
string(14) "txtMobilePhone"
["value"]=>
bool(false)
}
}
Run Code Online (Sandbox Code Playgroud)