本文整理汇总了PHP中FileMaker::getContainerData方法的典型用法代码示例。如果您正苦于以下问题:PHP FileMaker::getContainerData方法的具体用法?PHP FileMaker::getContainerData怎么用?PHP FileMaker::getContainerData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileMaker
的用法示例。
在下文中一共展示了FileMaker::getContainerData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fmGetContainer
//.........这里部分代码省略.........
// the record that the container was pulled from.
$container_info = html_entity_decode($container_field_array[1]);
$container_info = fmsubstitute($container_info, '-db', 'db');
$container_info = fmsubstitute($container_info, '&-', '&');
parse_str($container_info);
// fmDump ( $db, TRUE, 'db' );
// If the container contents file is available...
if (file_exists($physical_path_container_contents_file)) {
// Read the file.
$container_data = @file_get_contents($physical_path_container_contents_file);
} else {
// Using the database name, find the database connection to use...
foreach ($fm_databases as $fm_database) {
// If the connection was found...
if ($fm_database['database'] == $db) {
// Create a connection to the database.
$fm = new FileMaker();
$fm->setProperty('hostspec', $fm_database['hostspec']);
$fm->setProperty('database', $fm_database['database']);
$fm->setProperty('username', $fm_database['username']);
$fm->setProperty('password', $fm_database['password']);
break;
}
}
if (!isset($fm)) {
// Return control to the 404 error handler.
return;
}
// fmDump ( $fm, TRUE, 'fm' );
// Get the record that the container was pulled from.
$container_record = $fm->getRecordById($lay, $recid);
// fmDump ( $container_record, TRUE, 'container_record' );
// Get the container data.
$container_data = $fm->getContainerData($container_field_as_text);
if (FileMaker::isError($container_data)) {
die;
}
// fmDump ( $container_data, FALSE, 'container_data' );
// Save the container's contents on the server.
@file_put_contents($physical_path_container_contents_file, $container_data);
}
// If we have the container's content...
if (isset($container_data)) {
// Update the http response header, so that this does not appear to be a "404."
header('Status: 200', TRUE, 200);
// Explode the filename to get the extension.
$filename_parts = explode('.', $filename);
$extension = $filename_parts[1];
// If the extension includes a URL request...
if (fmPatternCount($extension, '?')) {
$extension_parts = explode('?', $extension);
$extension = $extension_parts[0];
}
// Setup the headers to use, based on the file type (extension).
switch ($extension) {
case 'gif':
header('Content-type: image/gif');
header('Content-Disposition: filename="' . $filename . '"');
break;
case 'jpeg':
header('Content-type: image/jpeg');
header('Content-Disposition: filename="' . $filename . '"');
break;
case 'jpg':
header('Content-type: image/jpeg');
header('Content-Disposition: filename="' . $filename . '"');
示例2: FileMaker
<?php
/**
* ContainerBridge.php
*
* Copyright © 2005-2006, FileMaker, Inc. All rights reserved.
* NOTE: Use of this source code is subject to the terms of the FileMaker
* Software License which accompanies the code. Your use of this source code
* signifies your agreement to such license terms and conditions. Except as
* expressly granted in the Software License, no other copyright, patent, or
* other intellectual property license or right is granted, either expressly or
* by implication, by FileMaker.
*
* This is a bridge script to call FileMaker::getContainerData given a url.
*/
require_once "FileMaker.php";
// Location of FileMaker Server is assumed to be on the same machine,
// thus we assume hostspec is api default of 'http://localhost' as specified
// in filemaker-api.php.
// If FMSA web server is on another machine, specify 'hostspec' as follows:
// $fm = new FileMaker('FMPHP_Sample', 'http://10.0.0.1');
$fm = new FileMaker('FMPHP_Sample');
echo $fm->getContainerData($_GET['path']);
示例3: testGetContainerData
/**
* @covers \airmoi\FileMaker\FileMaker::getContainerData
*/
public function testGetContainerData()
{
$record = $this->fm->newFindAnyCommand('sample')->execute()->getFirstRecord();
$datas = $this->fm->getContainerData($record->getField('container_field'));
$this->assertEquals(18556, strlen($datas));
}