Php 在我的codeigniter模型中使用文件操作函数时出现语法错误
我正在开发一个使用codeigniter的电子商务网站。当我使用fopen、fclose等文件操作函数时,它会在模型类中显示语法错误。有人知道怎么修吗?我在autoload.php中添加了“file”助手。我已经检查了NetBeans和Dreamweaver中的语法错误。这里我添加了一个示例类,其中包含我所面临的问题Php 在我的codeigniter模型中使用文件操作函数时出现语法错误,php,codeigniter,codeigniter-2,Php,Codeigniter,Codeigniter 2,我正在开发一个使用codeigniter的电子商务网站。当我使用fopen、fclose等文件操作函数时,它会在模型类中显示语法错误。有人知道怎么修吗?我在autoload.php中添加了“file”助手。我已经检查了NetBeans和Dreamweaver中的语法错误。这里我添加了一个示例类,其中包含我所面临的问题 <?php Class amazon extends CI_Model { var $feed = <<<EOD <?xml version=
<?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+');
}
?>
1.01
M_示例_123456
产品
假的
1.
更新
Intrug88888
阿辛
B0EXAMPLEG
A_GEN_NOTAX
1.
100
巴拉吉53444
测试套
试验3材料
0.10
示例项目类型
小孩
小的
白色
水彩
衬衫
男人
衣服
白色
白色
白色
四季
全体船员
短
假的
排爆药;
var$marketplaceIdArray=array(“Id”=>array('a33nv4543zupx1j3x');
变量$feedHandle=fopen('php://temp","rw+",;
}
?>
fopen不是codeigniter函数,而是php核心函数。请通过PHP执行此文件,因为您的代码似乎没有任何语法错误。那是什么
var
?:)
var
在PHP5中被弃用。删除该var,它不会给出错误
按如下方式更改文件的结尾:(或只需删除var
)
请用更高分辨率更新屏幕截图,文本不可读。将鼠标悬停在工具提示或复制粘贴上,会显示一条错误消息尝试替换上面的代码片段是屏幕截图中的内容,我的眼睛很好;)我换了。但是仍然有错误。但是错误信息是什么?当在codeigniter成员变量中使用linevar时,它应该出现。我已经在没有var的情况下测试过了,@etc兄弟。但是仍然会出现错误。在PHP5中不推荐使用var。这就是为什么会出现错误。删除该var,它就会工作。
$marketplaceIdArray = array("Id" => array('A333NV4543ZUPX1J3X'));
$feedHandle = fopen('php://temp', 'rw+');