CakePHP XAMPP Internet Explorer在10秒后丢失会话

时间:2014-10-27 14:55:44

标签: php internet-explorer session cakephp xampp

在视图中填写输入并单击提交按钮后,如果我使用Firefox,记录就会保存得很好。

如果我足够快,IE也是如此。但是当我等待10秒时,POST数据似乎无法到达Controller,我收到此错误消息

Notice (8): Undefined index: Incident [APP\Controller\IncidentsController.php, line 91]
Notice (8): Undefined index: Machine [APP\Controller\IncidentsController.php, line 93]Code 
Notice (8): Undefined index: Machine [APP\Controller\IncidentsController.php, line 94]Code 

$ this-> request->数据为空

仅在IE中出现。

控制器方法:

/**
    * c_add method
    *
    * @return void
    */
        public function c_add() {
            if ($this->request->is('post')) {
                $this->Incident->create();
                $machineId = $this->Incident->Machine->find('first', array('conditions' => array('Machine.name' => $this->request->data['Incident']['machine_id_scancode'])));
                $this->Incident->set(array(
                    'machine_id' => $machineId['Machine']['id'],
                    'costcenter_id' => $machineId['Machine']['costcenter_id'],
                    'inc_start' => date('Y-m-d H:i:s')
                ));
                if ($this->Incident->save($this->request->data)) {
                    $this->Session->setFlash(__('The incident has been saved.'));
                    return $this->redirect(array('action' => 'c_index'));
                } else {
                    $this->Session->setFlash(__('The incident could not be saved. Please, try again.'));
                }
            }
            $machines = $this->Incident->Machine->find('list');
            $products = $this->Incident->Product->find('list');
            $incidentClasses = $this->Incident->IncidentClass->find('list');
            $costcenters = $this->Incident->Costcenter->find('list');
            $problemTypes = $this->Incident->ProblemType->find('list');
            $problemCauses = $this->Incident->ProblemCause->find('list');
            $specialists = $this->Incident->Specialist->find('list');
            $this->set(compact('machines', 'products', 'incidentClasses', 'costcenters', 'problemTypes', 'problemCauses', 'specialists'));
        }

查看:

<?php $this->extend('/Common/customer'); ?>
<div class="incidents form">
<?php echo $this->Form->create('Incident'); ?>
    <fieldset>
        <legend><?php echo __('Add Incident'); ?></legend>
        <table>
            <tr>
                <td><?php   echo $this->Form->input('machine_id_scancode'); ?></td>
                <td><?php   echo(__('</br>Choose Machine by starting to type and pick one from the list. </br> If your machine is not on the list, pick the "Common" entry for your Team, e.g. "Allgemein PPT"')); ?></td>
            </tr>
            <tr>
                <td><?php echo $this->Form->input('customer_email'); ?></td>
                <td><?php   echo(__('</br><p id="emailDescription">Email adress for job progress notification. Change as you like.</p>')); ?></td>
            </tr>
            <tr>
                <td><?php echo $this->Form->input('inc_desc'); ?></td>
                <td><?php   echo(__('Please describe what should be done.')); ?></td>
            </tr>
            <tr>
                <td><?php echo $this->Form->input('product_id', array('empty' => true)); ?></td>
                <td><?php   echo(__('Optional: Choose which product is affected.')); ?></td>
            </td>
        </table>
    </fieldset>
<?php echo $this->Form->end(__('Submit')); ?>
</div>
<script>
$(function() {
    $("#IncidentMachineIdScancode").autocomplete({
        source: "/stoerungen/machines/index.json"
    });
});
$(document).ready(function() {
    $.ajaxSetup({cache: false});
    if (navigator.userAgent.match(/msie/i)){
        $.get("../get_email.php", function(data){
            $("#IncidentCustomerEmail").val(data.email);
            console.log("Got user's email Adress => " + data.email);
        }, "json");
    } else{
        $("#emailDescription").text('No IE, please fill your email manually');
        console.log('no IE')
    }
});
</script>

任何有助于追踪原因的建议都受到高度赞赏。 提前谢谢!

1 个答案:

答案 0 :(得分:0)

我将网络服务器从xampp的Apache更改为IIS。 那里不会出现问题。