【问题标题】:CakePHP XAMPP Internet Explorer losing Session after 10 secondsCakePHP XAMPP Internet Explorer 在 10 秒后丢失会话
【发布时间】:2014-10-27 14:55:43
【问题描述】:

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

如果我足够快,IE 也是如此。但是当我等待 10 秒时,POST 数据似乎没有到达控制器,我收到此错误消息

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>

非常感谢任何有助于追查原因的建议。 提前谢谢!

【问题讨论】:

    标签: php internet-explorer session cakephp xampp


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-23
      • 2016-01-18
      • 2012-08-26
      • 1970-01-01
      • 2011-02-26
      • 2023-04-04
      相关资源
      最近更新 更多