我正在使用codeigniter开发电子商务网站。当我使用文件操作函数如fopen,fclose时,它在模型类中显示语法错误。有谁知道如何解决它?我在autoload.php中添加了“file”帮助器。我检查了NetBeans和Dreamweaver中的语法错误。在这里,我添加了一个示例类,其中包含我面临的问题,
<?php
Class amazon extends CI_Model
{
var $feed = <<<EOD
<?xml version="1.0" encoding="iso-8859-1"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>M_EXAMPLE_123456</MerchantIdentifier>
</Header>
<MessageType>Product</MessageType>
<PurgeAndReplace>false</PurgeAndReplace>
<Message>
<MessageID>1</MessageID>
<OperationType>Update</OperationType>
<Product>
<SKU>INTRUG8888888</SKU>
<StandardProductID>
<Type>ASIN</Type>
<Value>B0EXAMPLEG</Value>
</StandardProductID>
<ProductTaxCode>A_GEN_NOTAX</ProductTaxCode>
<ItemPackageQuantity>1</ItemPackageQuantity>
<NumberOfItems>100</NumberOfItems>
<DescriptionData>
<Title>Balaji53444</Title>
<Brand>TESTERCLOTHING</Brand>
<Description><![CDATA[INTRUGTEST123 Test description of test product.]]></Description>
<BulletPoint>Test 3 Meterial</BulletPoint>
<MSRP currency="USD">0.10</MSRP>
<Manufacturer></Manufacturer>
<ItemType>example-item-type</ItemType>
</DescriptionData>
<ProductData>
<Clothing>
<VariationData>
<Parentage>child</Parentage>
<Size>Small</Size>
<Color>White</Color>
<VariationTheme>SizeColor</VariationTheme>
</VariationData>
<ClassificationData>
<ClothingType>Shirt</ClothingType>
<Department>Mens</Department>
<StyleKeywords>Apparel</StyleKeywords>
<ColorMap>White</ColorMap>
<InnerMaterial>White</InnerMaterial>
<OuterMaterial>White</OuterMaterial>
<Season>All Seasons</Season>
<CollarType>Crew</CollarType>
<SleeveType>Short</SleeveType>
<IsAdultProduct>false</IsAdultProduct>
</ClassificationData>
</Clothing>
</ProductData>
</Product>
</Message>
</AmazonEnvelope>
EOD;
var $marketplaceIdArray = array("Id" => array('A333NV4543ZUPX1J3X'));
var $feedHandle = fopen('php://temp', 'rw+');
}
?>
答案 0 :(得分:0)
fopen不是codeigniter函数,但它是php核心函数。请通过PHP执行此文件,因为您的代码似乎没有任何语法错误。
答案 1 :(得分:0)
var
? :)
var
在PHP 5中已弃用。删除该var,它不会出错。
更改文件的结尾,如下所示:(或只是删除var
)
$marketplaceIdArray = array("Id" => array('A333NV4543ZUPX1J3X'));
$feedHandle = fopen('php://temp', 'rw+');