How does php output variable names and values as they are? php-excel-reader: Operate on excel
$ Xls = new Spreadsheet_Excel_Reader ();
$ Xls-> setOutputEncoding ('utf-8 ');
$ Xls-> read ($ file_name );
For ($ I = 2; $ I <= $ xls-> sheets [0] ['numrows ']; $ I ++)
{
For ($ n = 1; $ n <= $ xls-> sheets [0] ['numcols']; $ n ++)
{
'$ '. $ Xls-> sheets [0] ['cells '] [1] [$ n] = $ xls-> sheets [0] ['cells'] [$ I] [$ n];
}
}
The red part is the title of the first line in excel. I made it into a field in the database, as shown in
Title name
Jackie Chan, China
Therefore, before warehouse receiving
$ Title = 'China ';
$ Name = 'Jackie Chan ';
How can I write the red part to make it look like the above?
Reply to discussion (solution)
... You can solve the problem by yourself.
'$ '. $ Xls-> sheets [0] ['cells '] [1] [$ n] = $ xls-> sheets [0] ['cells'] [$ I] [$ n];
Change
$ {$ Xls-> sheets [0] [cells] [1] [$ n] }=$ xls-> sheets [0] ['cells '] [$ I] [$ n];
The braces are missing.