0

I have this piece of code that causes my script to crash. I'm certain that there is some kind of quote mark confusion on my part. Have been staring at this for an hour now and can't find the error. Any help much appreciated.

The $title can include commas, could that be it? Removing all variables fixes the issue, maybe it's an issue with how I'm adding them or what they contain?

$contentopf = "
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<package xmlns=\"http://www.idpf.org/2007/opf\" unique-identifier=\"bookid\" version=\"3.0\" prefix=\"rendition: http://www.idpf.org/vocab/rendition/# ibooks: http://vocabulary.itunes.apple.com/rdf/ibooks/vocabulary-extensions-1.0/\">
  <metadata xmlns=\"http://www.idpf.org/2007/opf\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" >
     <dc:format>application/epub+zip</dc:format>
     <meta name=\"cover\" content=\"cover-image\" />
     <dc:title>".$title."</dc:title>
     <meta property=\"ibooks:version\">0.3.0</meta>
     <dc:creator id=\"aut\">".$fname." ".$lname"</dc:creator>
     <meta refines=\"#aut\" property=\"role\" scheme=\"marc:relators\">aut</meta>
     <meta refines=\"#aut\" property=\"file-as\">".$lname.", ".$fname"</meta>
     <dc:description>!</dc:description>
     <dc:publisher>".$publisher."</dc:publisher>
     <dc:date>".$year."</dc:date>
     <dc:language>".$lang."</dc:language>
     <dc:identifier id='bookid'>urn:uuid:".$uuid."</dc:identifier>
     <meta refines='#bookid' property='identifier-type' scheme='xsd:string'>uuid</meta>
     <dc:identifier id='isbn-id'>urn:isbn:".$isbn."</dc:identifier>
     <meta refines='#isbn-id' property='identifier-type' scheme='onix:codelist5'>15</meta>
     <meta property=\"dcterms:modified\">".$date."</meta>
     <meta property=\"rendition:layout\">pre-paginated</meta>
     <meta property=\"rendition:orientation\">landscape</meta>
     <meta property=\"rendition:spread\">none</meta>
     <meta property=\"ibooks:specified-fonts\">true</meta>
     <meta property='ibooks:iphone-orientation-lock'>landscape-only</meta>                                     
     <meta property='ibooks:ipad-orientation-lock'>landscape-only</meta>                          
</metadata>
";

echo $contentopf;
4

2 に答える 2

0

.ここを忘れた

".$fname"</meta>

する必要があります

".$fname."</meta>

ここでも

".$lname."</dc:creator>
于 2013-04-04T11:41:26.113 に答える
0

ここにドットがありません:

 <meta refines=\"#aut\" property=\"file-as\">".$lname.", ".$fname"</meta>

する必要があります

<meta refines=\"#aut\" property=\"file-as\">".$lname.", ".$fname."</meta>

PS : プレースホルダーを使用する printf() のような代替手段に切り替えることを本当に考えるべきです。

于 2013-04-04T11:42:00.767 に答える