小编Moh*_*qar的帖子

从模型实例YII获取模型名称

如何从模型实例中获取模型名称.对于前者

$ model = new State;

这里,State是model $ model是State model instance.

我想得到模型名称,即来自$ model的状态,即模型实例.

php yii

10
推荐指数
2
解决办法
2万
查看次数

HTML表格excel - PHP

我正在以表格格式创建报告.此报告显示在浏览器上.我想以excel格式链接提供下载报告,以便报告也可以在excel文件中使用.我怎样才能做到这一点

html php excel

10
推荐指数
2
解决办法
4万
查看次数

使用单个事务提交和回滚的多个模型的事务管理

我是cakephp的新手.我想知道在cakephp中是否可以使用单个事务处理多个模型提交和回滚.我想做这样的事情

<?php
function add(){
    $transaction = begintransaction;
    if(model1->save()){
        if(model2->save()){
            if(model3->save(){
            }
            else{
                $errorFlag['model3'] = "Error in model 3"; 
            }
        }
        else{
            $errorFlag['model2'] = "Error in model 2";
        }
    }
    else{
        $errorFlag['model3'] = "Error in model 3";
    }
    if(empty($errorFlag)){ //no error in saving the model
        $transaction->commit();
        $this->Session->setFlash(__('The form data with multiple model is saved', true)); 
    }
    else{   //error in saving the model
        $transaction->rollback();
        $this->Session->setFlash(__('The form data with multiple model is saved', true));
    }
}
?>
Run Code Online (Sandbox Code Playgroud)

cakephp transactions cakephp-model

5
推荐指数
1
解决办法
4615
查看次数

获取任何网站"联系我们"页面的地址

我想捕获"联系我们"页面上给出的地址.有没有PHP脚本可以这样做?

我很震惊.我的客户想要存储"联系我们"页面上给出的网站的地址.我可以从页面获取内容.但我很困惑如何从这个页面只获取地址.

例如:www.abc.com/contactus
包含

办公地址:

  • X路,
  • X市
  • pin xxxxx
  • X国家

我怎么能得到这个地址?

html php

-2
推荐指数
1
解决办法
179
查看次数

标签 统计

php ×3

html ×2

cakephp ×1

cakephp-model ×1

excel ×1

transactions ×1

yii ×1