我遇到一个问题,即我的班子显然没有被正确划分,所有档案似乎都正确存在。
我的等级是:
|
|_ _includes
|__classes
|___class.login.php
|___class.fmdb.php
|__ fm_api
|___FileMaker.php
|
|_ public_html
|__login.php
(我希望是这样说的——在引言中封顶的是夹)
我的问题是,我的法典显然没有得到正确执行,而浏览器只是显示等级法。
这里是我的两个班级:
班级:
<?php
require_once ( config/config.constants.php );
require_once ( classes/class.fmdb.php );
/**
* Performs all the Login actions
*
* @author RichardC
*/
class Login {
protected $fm;
protected $fmdb;
public function __construct() {
$this->fm = new FileMaker(constant( FMDB_NAME ), constant( FMDB_IP ), constant( FMDB_USERNAME ), constant( FMDB_PASSWORD ));
$this->fmdb = new FMDB();
}
}
班次fmdb.php:
<?php
require_once ( fm_api/FileMaker.php );
/**
* Database interface for the Scheduler
*
* @author RichardC
*/
class FMDB {
/**
* Setting the class-wide variables
*/
protected $fm;
protected $layout = ;
protected $records = array();
public $lastObj = null;
/**
* The constructor of the class
*/
public function __construct() {
$this->fm = new FileMaker(FMDB_NAME, FMDB_IP, FMDB_USERNAME, FMDB_PASSWORD);
}
/**
* Returns an Error if there is one, for example: error 401 (record missing)
*
* @author RichardC
* @since 1.0
*
* @version 2.0
*
* @param obj $request_object
*
* @return int (error Code || 0 on no error)
*/
public static function isError($request_object) {
//The reason it returns 0 instead of false is due to the getCode() method, which will return the original error code so you can check if isError( $res ) > 0
return (FileMaker::isError($request_object) ? $request_object->getCode() : 0);
}
/**
* Selects data from a FileMaker Database
*
* @author RichardC
* @since 1.0
*
* @version 1.0
*
* @param string $layout
* @param array $arrSearchCriteria
* @param bool $recordId (true to get the Record ID or false to ignore)
*
* @example $objScheduler->select( someLayout , array( FieldName => Value ), true);
*
* @return array
*/
public function select($layout, $arrSearchCriteria) {
$arrOut = array();
if ((!is_array($arrSearchCriteria))) {
return false;
}
$findReq = $this->fm->newFindCommand($layout);
foreach ($arrSearchCriteria as $field => $value) {
$findReq->addFindCriterion($field, $value);
}
$results = $findReq->execute();
//Checks for an error
if ($this->isError($results) === 0) {
$records = $results->getRecords();
//Set the last layout used
$this->layout = $layout;
$this->lastObj = $records;
foreach ($records as $record) {
$arrOut[] = $record;
foreach ($record->getFields() as $field) {
$this->records[] = $field;
}
}
} else {
$arrOut[ errorCode ] = $this->isError($results);
}
return $arrOut;
}
/**
* Secures a string using mysql_real_escape_string and htmlentities
*
* @author RichardC
* @since 1.0
*
* @version 1.0
*
* @param string $string
*
* @return string
*/
public function fm_escape_string($string) {
return mysql_real_escape_string(htmlentities($string));
}
/**
* Get the records returned by the Select in an array
*
* @author RichardC
* @since 1.0
*
* @version 1.0
*
* @return array
*/
public function getRecords() {
return $this->records;
}
/**
* Set fields by in the Layout with the given fields and values
*
* @author RichardC
* @since 1.0
*
* @version 1.2
*
* @param array $arrFields
*
* @note If you want to specify a layout, please use the update function.
*
* @return boolean
*/
public function setFields($arrFields) {
$blOut = false;
if ((!is_array($arrFields))) {
return false;
}
$layout = (empty($layout) ? ($this->layout) : ($layout));
$records = $this->lastObj;
// The record object is already initialised
if (isset($records) && !empty($records)) {
foreach ($records as $record) {
foreach ($arrFields as $fieldName => $value) {
$setFields[] = $record->setField($fieldName, $value);
}
}
$commit = $record->commit();
if ($this->isError($commit) === 0) {
$blOut = true;
} else {
return $this->isError($commit);
}
}
//Speed things up
unset($record, $commit, $fieldName, $value);
return $blOut;
}
/**
* Update the fields on a layout with specified data
*
* @author RichardC
* @since 1.0
*
* @version 1.0
*
* @param string $layout
* @param array $arrFields
* @param int $iRecordID
*
* @example $objFM->update( exampleLayout , array( Field1 => This is the data which Field1 will be updated with ), 1);
*
* @return boolean
*/
public function updateRecordByID($layout, $arrFields, $iRecordID) {
$blOut = false;
if (($layout == ) || (!is_array($arrFields)) || (!is_number($iRecordID))) {
return false;
}
$findReq = $this->fm->newFindCommand($layout);
//Loops through setting the where clause
foreach ($where as $field => $value) {
$findReq->addFindCriterion($field, == . $value);
}
$result = $findReq->execute();
//Checks for errors
if ($this->isError($result) === 0) {
$result = $this->fm->getRecordById($layout, $iRecordID);
//Loops through each result from the Select
foreach ($records as $record) {
//Loops through all given fields and values, setting the fields to be said values
foreach ($arrRecords as $f => $v) {
$record->setField($f, $v);
}
$commit = $record->commit();
}
//Checking for errors
if ($this->isError($commit) === 0) {
$blOut = true;
} else {
return $this->isError($commit);
}
} else {
return $this->isError($result);
}
// Speed things up
unset($result, $commit, $record, $findReq);
return $blOut;
}
/**
* Inserts a record into the Table/Layout with the given data from $arrFields
*
* @author RichardC
* @since 1.0
*
* @version 1.0
*
* @param string $layout
* @param array $arrFields
*
* @return boolean
*/
public function insert($layout, $arrFields) {
$blOut = false;
if (($layout == ) || (!is_array($arrFields))) {
return false;
}
$addCmd = $this->fm->newAddCommand($layout, $arrFields);
$result = $addCmd->commit();
if ($this->isError($result) === 0) {
$blOut = true;
} else {
return $this->isError($result);
}
//Speed things up
unset($addCmd, $result);
return $blOut;
}
/**
* List Layout Names from Database
*
* @author RichardC
* @since 1.0
*
* @version 1.0
*
* @return array
*/
public function get_layout_names() {
return $this->fm->listLayouts();
}
/**
* Alias of the select function
*
* @author RichardC
* @since 1.0
*
* @version 1.0
*
* @param string $layout
* @param array $arrSearchCriteria
*
* @return array
*/
public function find($layout, $arrSearchCriteria) {
return $this->select($layout, $arrSearchCriteria);
}
/**
* Returns the number of rows in a given query
*
* @author RichardC
* @since 1.0
*
* @version 1.0
*
* @param array $arrResult
*
* @return int
*/
public function fm_num_rows($arrResult) {
return (!is_array($arrResult) ? 0 : count($arrResult));
}
/**
* Runs a script on the server from the web
*
* @author RichardC
* @since 1.0
*
* @version 1.0
*
* @param string $layout
* @param string $scriptName
* @param array $params (Optional depending on the script params that you wish to execute)
*
* return boolean
*/
public function runScript($layout, $scriptName, $params = array()) {
$blOut = false;
if ((empty($layout)) || (empty($scriptName))) {
return $blOut;
}
if ($this->fm->newPerformScriptCommand($layout, $scriptName, $params)) {
$blOut = true;
}
return $blOut;
}
/**
* Rec-ID (FileMaker Record ID hidden field)
*
* LayoutName, Field Value, FieldName
*/
public function getLastID() {
}
public function delete($layout, $iRecordID) {
// Example from $this->update :: $result = $this->fm->getRecordById($layout, $iRecordID);
}
/**
* Gets the record ID from the current record
*
* @author RichardC
* @since 1.0
*
* @return int
*/
public function getRecordId() {
return $this->lastObj->getRecordId();
}
}
?>
这就是我称之为以下职能时所恢复的情况:
由于其中一些法律的性质是保密的,我无法向你们介绍所有法典,但任何关于为什么会这样做的建议都将是一个很大的帮助!
感谢!
<><>>
职业介绍,我所展示的法典只是每一类的刀子。 由于这是与工作相关的项目,我不能把全班代码放在后面。