好吧,我终于想出了如何通过form API
Drupal 添加(或编辑)表单控件.
但现在,我想在表单中添加文字.不是<textarea>
,不是<textfield>
; 两者都可以由用户编辑.我想补充一下<p>static text</p>
,由我写的,由用户阅读.
如何做到这一点?
在 LAMP 堆栈上,我无法让 xSendFile 工作。问题是下载有 0 个字节。
为了确保我安装了 xSendFile,我已将其添加到我的.htaccess
文件中:
<IfModule mod_xsendfile.c>
SetEnv MOD_mod_xsendfile 1
</IfModule>
Run Code Online (Sandbox Code Playgroud)
(我无法测试这个,apache_get_modules()
因为我将 PHP 作为 fastCGI 运行。)
然后我有以下 PHP 代码:
if (1 != getenv('MOD_mod_xsendfile'))
{
echo 'mod_xsendfile is not installed';
}
else
{
$path = '/home/infar/';
$file = 'hello.txt';
if (file_exists($path.$file) && strlen($path.$file)>1)
{
if (true) // change to false to go around Yii
{
Yii::app()->request->xSendFile($path.$file,array(
'saveName'=> 'hello.txt',
'mimeType'=> 'plain/text',
'terminate'=> true,
));
}
else
{
//set proper Content-Type
header('Content-Type: plain/text');
//force download …
Run Code Online (Sandbox Code Playgroud) 我想实现以下目标:
intent
在我的 MainActivity 中,我使用布尔值在USE_ANDROID_EXTERNAL_STORAGE_PUBLIC_DIRECTORY
以下之间切换:
ExternalFilesDir
(在我的例子中:/storage/emulated/0/Android/data/pub.openbook.labellor/files/Pictures)Public Directory
(在我的例子中为/storage/emulated/0/DCIM)相机应用程序将成功地将照片文件保存在ExternalFilesDir中,但无法将文件保存到其公共目录中。由于这种情况发生在相机应用程序中,我无法对此进行调试。
我的问题:
(我的函数galleryAddPic()
完成时没有崩溃,但没有达到目的。照片在图库应用程序中仍然不可见。)
我正在与:
android.os.Build.VERSION.SDK_INT
23package pub.openbook.labellor;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.FileProvider;
import android.os.Environment; …
Run Code Online (Sandbox Code Playgroud) 在Yii2中,我无法启用漂亮的网址.
我的配置:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
],
Run Code Online (Sandbox Code Playgroud)
我的.htaccess:
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
Run Code Online (Sandbox Code Playgroud)
我的剧本:
echo 'enablePrettyUrl: ';
echo Yii::$app->urlManager->enablePrettyUrl ? 'true ' : 'false';
echo '<br>';
echo 'enableStrictParsing: ';
echo Yii::$app->urlManager->enableStrictParsing ? 'true ' : 'false';
echo '<br>';
echo 'showScriptName: ';
echo Yii::$app->urlManager->showScriptName ? 'true ' : 'false';
echo Url::to(['/book/read', 't' => …
Run Code Online (Sandbox Code Playgroud) 我有一个用户上传电影的网站(MP4,FLV,OGV).
我需要一个PHP函数来自上传的电影自动生成JPG中的海报/截图.截图应该是电影的开场景.
如果它是一个javascript实用程序(而不是PHP),那也没关系.
我找不到任何东西.我应该在哪里看?
我有一个yii2 GridView,由gii CRUD生成.
我指向我的浏览器/model/index
.我没有在GET字符串中包含任何搜索值.但GridView过滤器预先填充了值.
即使我尝试删除或替换这些过滤器值,预先填充的值也会回弹.
我注意到这些预先填充的值来自模型的beforeValidate()
方法.
public function beforeValidate()
{
if (parent::beforeValidate()) {
if ($this->isNewRecord) {
$this->created_at = time();
$this->b_soft_deleted = 0;
}
$this->updated_at = time();
return true;
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
显然,GridView过滤器调用beforeValidate()
并将这些值用于过滤器...
(在php 7.0.14上运行yii2 2.0.10)
更新我的搜索模型是
<?php
namespace common\models\generated;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Article;
/**
* ArticleSearch represents the model behind the search form about `common\models\Article`.
*/
class ArticleSearch extends Article
{
/**
* @inheritdoc …
Run Code Online (Sandbox Code Playgroud) 这是给你的FFMPEG大师!
我有视频,我拍了截图.这很好用:
ffmpeg -i sourceMovie.mp4 -ss 0 -vframes 1 destImage.jpg
Run Code Online (Sandbox Code Playgroud)
但我希望一下子将图像缩小到150像素宽.显然,我应该补充一下
scale=150:-1
Run Code Online (Sandbox Code Playgroud)
但是我在哪里以及如何在命令中插入它?
我尝试了一切; 什么都行不通
Android 网络服务发现为我们提供了一个onResolveFailed()
回调,如下所示:
NsdManager.ResolveListener mResolveListener = new NsdManager.ResolveListener() {
@Override
public void onResolveFailed(NsdServiceInfo serviceInfo, int errorCode) {
// Called when the resolve fails. Use the error code to debug.
Log.e(TAG, "Resolve failed " + errorCode);
}
};
Run Code Online (Sandbox Code Playgroud)
在我的情况下,我得到errorCode 3.
这些erorCodes代表什么,我会在哪里找到指定的?
android ×2
php ×2
yii2 ×2
.htaccess ×1
api ×1
camera ×1
drupal ×1
drupal-7 ×1
drupal-forms ×1
ffmpeg ×1
forms ×1
gridview ×1
java ×1
javascript ×1
movie ×1
nsd ×1
screenshot ×1
x-sendfile ×1
yii ×1