草庐IT

set_no_cache

全部标签

php - Yii2 无效调用 : Setting read-only property

我有一个Post模型,它与Tags有很多对多的关系。在Post模型中定义:publicfunctiongetTags(){return$this->hasMany(Tags::className(),['id'=>'tag_id'])->viaTable('post_tags',['post_id'=>'id']);}但是Post::tags是只读的。因此,当我尝试在Controller中设置它们时,出现错误:InvalidCall–yii\base\InvalidCallExceptionSettingread-onlyproperty:app\models\Post::tagsCo

PHP ini_set 内存限制

当我们在代码中像下面这样使用ini_set时,所有其他代码的内存限制是否相同?或者只对我们添加的代码有效?ini_set('memory_limit','512M');谢谢 最佳答案 它只对写入它的文件有效。更改同一文件夹中多个php设置的最佳方法是:1。使用以下行创建名为“.htaccess”的文件php_valuememory_limit'512M'请记住,这仅在您的服务器配置允许此目录的“AllowOverride”指令时有效2。使用您的配置选项添加自己的php作为auto-prepend-file您可以在php.ini中执行

PHP 7.2 : no additional . ini 文件已解析

我有一个ubuntu服务器(16.04.4LTS),apache2运行php7.0(Apache2.0Handler)和php7.2(FPM/FastCGI)。PHP7.2工作正常,只是没有加载任何扩展——比如json或其他任何东西。查看我的phpinfo():SystemLinuxsrvindkdif4.4.0-62-generic#83-UbuntuSMPWedJan1814:10:15UTC2017x86_64BuildDateJun22201808:44:50ServerAPIFPM/FastCGIVirtualDirectorySupportdisabledConfigura

PHP session 开始 "Cannot send session cookie and cache limiter"

我已将托管服务器从Windows系统更改为Linux系统。但是当我运行我的PHP程序时,我得到了这个错误:Warning:session_start()[function.session-start]:Cannotsendsessioncookie-headersalreadysentby(outputstartedat/home/content/p/y/c/francis/html/login/login.php:2)in/home/content/p/y/c/francis/html/login/login.phponline4和Warning:session_start()[fu

php - Url 在 codeigniter 中无法正常工作,给出错误 "No input file specified"。

我将我的codeigniter应用程序上传到演示服务器。Homepage打开正常,但其他页面显示error.我将配置文件中的baseurl更改为:$config['base_url']='http://globalcfos.com/cfoask/';它在本地运行良好。知道如何解决吗? 最佳答案 看起来您是在GoDaddy上托管的,之前遇到过同样的问题,将您的.htaccess文件更改为以下应该可以解决它。RewriteEngineOnRewriteBase/RewriteCond%{REQUEST_FILENAME}!-fRewri

php - file_get_contents() 无法打开流 : No such file or directory

我正在编写一些php脚本来更新我网站上的代码。为了做到这一点,我编写了以下行来检查更新版本,并从我用来分发更新的地方获取名称,然后创建该名称的链接。我做过这样的事情。$filename="http://www.hf-live.com/codeupdate/Get_Files_Name.php";$contents=file_get_contents($filename);echo$contents;我收到这个错误failedtoopenstream:Nosuchfileordirectory.即使文件存在,我仍然遇到同样的错误。我已将allow_url_fopen开启为on。上面的代码

php - 压缩存档 PHP : Close() returns false with no error message

我正在尝试使用基于数组结构的目录树创建一个zip文件。我已经在使用thisanswer当我需要从目录树创建一个zip文件时,但在这种情况下,所有文件都在同一目录中,目录树基于数据库中的其他数据。我已经检查过所有文件都在正确的路径中,并且foreach循环正在运行。$zip->close发生错误。这就是代码(原始数组在每一层都有很多条目):$zip_array=array('Level1'=>array('Level2'=>array('file1'=>'/var/www/html/pdf/683026577.pdf','file2'=>'/var/www/html/pdf/683026

php - CakePHP 3 : Changing structure of result set

我是CakePHP新手,遇到以下问题:我有表“图片”、“关键字”和“关键字类别”。每个图像都可以有多个关键字(多对多),每个关键字都有一个类别(多对一)。使用检索图像列表$images=$this->Images->find()->contain(['Keywords','Keywords.KeywordCategories']);返回这样的结果结构:[{"id":1,"keywords":[{"keyword":"Dog","keyword_category":{"title":"Animal"}},{"keyword":"Cat","keyword_category":{"titl

php - Laravel 5 错误 SQLSTATE[HY000] [1045] 拒绝用户 'forge' @'localhost' 访问(使用密码 : NO)

有时(大约每20个请求)我会收到此错误。但是下一个(下一秒),同样的请求,就可以了。我不知道为什么第一个失败了。有时我会得到另一个错误:Nosupportedencrypterfound.Thecipherand/orkeylengthareinvalid.我的.env数据库参数没有问题。我已经使用phpartisankey:generate生成了一个key此key在我的.env文件中的APP_KEYkey下我的config/app.php有一个key'key'=>env('APP_KEY'),'cipher'=>'AES-256-CBC'有人知道这是怎么发生的吗?

php - file_put_contents(.../bootstrap/cache/services.json) : failed to open stream: No such file or directory

我在运行任何phpartisan命令时一直收到此错误。[ErrorException]file_put_contents(/Applications/MAMP/htdocs/code/bheng/md-bheng/bootstrap/cache/services.json):failedtoopenstream:Nosuchfileordirectory我该如何阻止它? 最佳答案 编辑-如果services.json文件不存在,运行phpartisanserve然后停止强制创建文件。请参阅:laravelservices.jsonn