我在ubuntu 13.10中配置Zend应用程序(ZF2).请按照以下步骤操作:
/var/www/名称中zfapp虚拟主机配置:
<VirtualHost *:80>
ServerName zfapp.com DocumentRoot /var/www/zfapp/
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
在中创建虚拟主机 /etc/hosts
127.0.0.1 zfapp.com
添加文件 /etc/apache2/sites-available/zfapp.cof
sudo a2enmod rewrite
sudo a2ensite zfapp.conf
sudo service apache2 restart
但是,当我浏览网站(zfapp.com/api/user/auth); 它给出以下错误:
未找到
/api/user/auth在此服务器上找不到 请求的Url
我有一个javascript MVC项目,其中我使用PHP作为服务器端语言.
这是项目目录结构:
ProjectDir javascriptMVC文件夹 - >模型/控制器jsfiles api文件夹 - > Zend项目
我做了一个符号链接的API,其指向 …
我正在尝试找出<cfscript>在ColdFusion 9中调用动态方法的正确语法.我已经尝试了许多变体并进行了很好的搜索.
<cfinvoke>显然是我想要的标签,遗憾的是,我不能在我的纯cfscript组件中使用它,因为它是在ColdFusion 10中实现的.
我在我的CFC中尝试了以下内容:
/** Validate the method name **/
var resources = getResources();
if (structKeyExists(variables.resources, name)) {
variables.resourceActive[name] = true;
var reflectionMethod = resources[name];
var result = "#reflectionMethod.getMethodName()#"(argumentCollection = params);
}
Run Code Online (Sandbox Code Playgroud)
返回值reflectionMethod.getMethodName()是我想要调用的方法名称.它100%返回正确定义和访问该方法的正确值(方法名称),
我的错误是该行的语法错误.
我遇到了以下错误:
Datasource names for all the database tags within the cftransaction tag must be the same.
这来自以下代码:
transaction action="begin" {
try {
var data = {};
data.time = getTickCount();
addToLog("Persist", "Started persist operations");
doClientPersist();
cleanUp(arguments.importId);
addToLog("Persist", "Completed the persist operations successfully", ((getTickCount()-data.time)/1000));
return true;
} catch (any e) {
transactionRollback();
data.error = e;
}
}
Run Code Online (Sandbox Code Playgroud)
该事务有效地将分配的较低级别方法包装在doClientPersist(). 一个这样的调用,在我们的框架数据库抽象层的深处,从一个单独的数据源(假设邮政编码数据源)获取(选择)经度和纬度信息——这个数据源是严格只读的。
<cffunction name="getLatitudeAndLongitude" access="package" returntype="query" output="false">
<cfargument name="postcode" type="string" required="true" />
<cfset var qPostcode = ''/>
<cfquery name="qPostcode" datasource="postcodesDatasource">
SELECT
a.latitude,
a.longitude …Run Code Online (Sandbox Code Playgroud) 我发现了一些与此问题相关的其他帖子,但是我无法实现我想要的,所以我决定删除所有内容并从一些帮助开始...
到目前为止,这是我的工作,它完成了工作,但数据是在数组中硬编码的,我需要创建一个数据库连接来获取这些数据.
在我的模块类中,我有:
public function getViewHelperConfig()
{
return array(
'factories' => array(
'liveStreaming' => function() {
return new LiveStreaming();
},
),
);
}
Run Code Online (Sandbox Code Playgroud)
这是我在视图助手中的代码:
namespace Application\View\Helper;
use Zend\View\Helper\AbstractHelper;
class LiveStreaming extends AbstractHelper
{
protected $liveStreamingTable;
public function __invoke()
{
$events = array(
'1' => array('name' => 'Event name',
'sport' => 'Soccer',
'time' => '11:30'),
'2' => array('name' => 'Event name',
'sport' => 'Soccer',
'time' => '17:00'),
);
return $events;
//this is what should be used (or something like that) to …Run Code Online (Sandbox Code Playgroud) 我有1000个对象,每个对象需要一个"键".
例如
$this->setItem("1", $object);
$this->setItem("2", $object);
Run Code Online (Sandbox Code Playgroud)
我的问题是,每次我使用$this->setItem()或$this->addItem()Zend正在创建一个带.dat文件的新文件夹.
我想.dat为所有对象只创建一个文件,但是我可以用它来调用它$this->getItem("key")
因此,我问这两个函数有什么区别?
当然,我可以通过该addItem()功能实现目标.
我创建了一个抽象的file parsercfc.听起来,这会抽象出从文件系统中读取文件时所需的一些常见任务.
所述组件的一个子节点用于解析XML文件并返回coldfusion XML文档.现在这一切都很完美,但是,我无法弄清楚的一件事是如何明确定义xml文档的返回类型,这是我强烈要强制执行的.
负责返回XML文档的方法如下:
public coldfusion.xml.XmlNodeList function parse(string filePath = "", boolean isCaseSensitive = false, string validator = "")
{
super.parse(arguments.filePath);
var data = getData();
if (len(arguments.validator)) {
setDocument(xmlParse(data, arguments.isCaseSensitive, arguments.validator));
} else {
setDocument(xmlParse(data, arguments.isCaseSensitive));
}
return getDocument();
}
Run Code Online (Sandbox Code Playgroud)
您可以看到返回类型是coldfusion.xml.XmlNodeList.我已经设法通过使用以下客户端代码弄清楚.
<cfscript>
factory = new Library.parser.Factory();
parser = factory.getParser("XmlFileParser");
xmlDoc = parser.parse("/var/www/development/Framework/test/testfile.xml");
/** XMLDoc is now a coldfusion document object **/
writeDump(xmlDoc);
writeDump(getMetadata(xmlDoc).getName()); /** outputs coldfusion.xml.XmlNodeList **/
</cfscript>
Run Code Online (Sandbox Code Playgroud)
这是不正确的,我得到的错误是:
The value returned from …
我有这个错误消息与Centos 5.9,PHP 5.4和较旧的PHP程序扩展(typo3 CMS).
PHP致命错误:已在第279行的class.tx_spscoutnetcalendar_pi1.php中删除了调用时传递引用
这是模拟php代码的功能:
// ********* Start XML code *********
// get XML data from an URL and return it
function fetchCalendarData($xmlUrl,$timeout) {
$xmlSource="";
$url = parse_url($xmlUrl);
$fp = fsockopen($url['host'], "80", &$errno, &$errstr, $timeout);
if ($fp) {
fputs($fp, "GET ".$url['path']."?".$url['query']." HTTP/1.1\r\nHost: " . $url['host'] . "\r\n\r\n");
while(!feof($fp))
$xmlSource .= fgets($fp, 128);
}
// strip HTTP header
if ($pos = strpos($xmlSource,"<?xml")) { // this has to be the first line
$xmlSource = substr($xmlSource, $pos);
} else {
$xmlSource="";
} …Run Code Online (Sandbox Code Playgroud) 我正在使用带有学说 2 的 Zend 框架 3,它给了我这个错误,我不知道为什么
致命错误:未捕获的异常“Zend\ServiceManager\Exception\ServiceNotFoundException”,消息为“无法将服务“路由器”解析到工厂;你确定你在配置过程中提供了它吗?在 C:\xampp\htdocs\zendf\vendor\zendframework\zend-servicemanager\src\ServiceManager.php:681 堆栈跟踪:#0 C:\xampp\htdocs\zendf\vendor\zendframework\zend-servicemanager\src\ServiceManager .php(757): Zend\ServiceManager\ServiceManager->getFactory('Router') #1 C:\xampp\htdocs\zendf\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(200): Zend\ServiceManager \ServiceManager->doCreate('Router') #2 C:\xampp\htdocs\zendf\vendor\zendframework\zend-mvc\src\Application.php(158): Zend\ServiceManager\ServiceManager->get('Router' ) #3 C:
我最近注意到我们的产品有许多"短"邮政编码的错误邮政编码位置(纬度和长坐标) - 即"AB10"而不是"ABD 1PT"等.
邮政编码数据库/表格用于在谷歌地图上生成图钉,我现在已经知道,当我们将短邮政编码合并到带有完整邮政编码的表格时,有些(约2200)被错误地输入了经度和纬度绕错了路.
显然这是一个简单的修复,因此我决定编写一个小脚本来处理不正确的值(基本上交换它们).
这是我有的:
<cfscript>
/** Fetch the wrong postcodes data **/
db = "postcodes";
sql = "
SELECT
postcode, longitude, latitude
FROM
postcodes
WHERE
longitude > latitude
";
q = new Query(sql = trim(sql), datasource = db);
data = q.execute().getResult();
if (structKeyExists(form, "execute")) {
if (isQuery(data) && data.recordCount > 0) {
transaction action="begin"
{
try {
qUpdate = new Query(
datasource = db,
sql = "UPDATE postcodes SET longitude = :longitude, latitude = :latitude WHERE postcode …Run Code Online (Sandbox Code Playgroud) php ×5
coldfusion ×4
coldfusion-9 ×4
mysql ×3
apache ×1
caching ×1
cfc ×1
transactions ×1
ubuntu ×1
virtualhost ×1