4

codeigniter を使用して e コマース サイトを開発しています。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+');

}
?>

ここに画像の説明を入力 ここに画像の説明を入力

4

2 に答える 2

0

fopen は codeigniter 関数ではなく、php コア関数です。コードに構文エラーはないようですので、このファイルを PHP 経由で実行してください。

于 2013-02-07T09:57:09.350 に答える
0

それは何varですか?:)

varPHP 5 では非推奨です。その var を削除すると、エラーが発生しなくなります。

ファイルの末尾を次のように変更します (または単に削除しますvar) 。

$marketplaceIdArray = array("Id" => array('A333NV4543ZUPX1J3X'));
$feedHandle = fopen('php://temp', 'rw+');
于 2013-02-07T10:16:10.170 に答える