我的网站文件夹结构如下......
Application Root
|- administration
|--|- application
|--|- system
|--|- index.php
|--|- web.config
|
|- application
|- system
|- index.php
|- web.config
Run Code Online (Sandbox Code Playgroud)
CI这里安装了两个框架.
这里我说的是administration子文件夹.
我的web.config URL Rewrite如下所示.
<rules>
<rule name="Rewrite to index.php">
<match url="index.php|robots.txt|images|test.php" />
<action type="None" />
</rule>
<rule name="Rewrite CI Index">
<match url=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" pattern="css|js|jpg|jpeg|png|gif|ico|htm|html" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:0}" />
</rule>
</rules>
Run Code Online (Sandbox Code Playgroud)
问题是,如果我删除index.php从$config['index_page']的site_root/administration/application/config/config.php,任何控制器功能显示未找到404页.网站root web.config实际上是这样做的.
我想index.php从子目录中的URL中删除.
1.我怎么能通过它 …
我试图通过函数获取文档的基本路径,因为我不想找到像../folder1/folder2/mypage.php或的路径../../../folder1/folder2/somepage.php.
所以我试过......
function getBaseUrl() {
// output: /myproject/index.php
$currentPath = $_SERVER['PHP_SELF'];
// output: Array ( [dirname] => /myproject [basename] => index.php [extension] => php [filename] => index )
$pathInfo = pathinfo($currentPath);
// output: localhost
$hostName = $_SERVER['HTTP_HOST'];
// output: http://
$protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,5))=='https://'?'https://':'http://';
// return: http://localhost/myproject/
return $protocol.$hostName.$pathInfo['dirname']."/";
}
Run Code Online (Sandbox Code Playgroud)
然后我给写代码......
$base = getBaseUrl();
require_once $base.'_include/db/qry.php';
require_once $base.'_include/db/functions.php';
Run Code Online (Sandbox Code Playgroud)
这两个文件qry.php和functions.php在http://localhost/mysite/_include/db/
当我运行页面时,错误显示...
Warning: require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 …Run Code Online (Sandbox Code Playgroud) 我html和javascript代码工作正常.但是当我把它放进去时asp.net,javascript代码无效.
我的html代码是......
<div class="form-group">
<label class="col-md-3 col-xs-12 control-label">Work Completed</label>
<div class="col-md-6 col-xs-12">
<div class="input-group">
<span class="input-group-addon">%</span>
<input type="text" class="form-control" name="" id="tval" oninput="changeDiv()" runat="server"/>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-xs-12 control-label"></label>
<div class="col-md-6 col-xs-12">
<div class="progress progress-thick progress-striped active">
<div id="p_bar" class="progress-bar progress-bar-success" role="progressbar" ></div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
而javascript代码是
<script type="text/javascript">
function changeDiv() {
tval = document.getElementById('tval').value;
document.getElementById('p_bar').setAttribute("style", "width:" + tval + "%");
}
</script>
Run Code Online (Sandbox Code Playgroud)
这非常有效.上面的代码是progressbar …
我的询问是......
SELECT
tbl1.FeeName,
SUM(tbl1.FeeAmount) AS TotAmt
FROM
tbl1
WHERE
tbl1.DateTaken BETWEEN '2017-06-02' AND '2017-06-06'
GROUP BY
tbl1.FeeId
Run Code Online (Sandbox Code Playgroud)
输出是......
该表还包含上述日期之间未进行的其他费用(交易),因此未在query结果中显示.
我想显示那些FeeNames,值应为0.就像下面(黄色结果).
我该怎么办 ?
我需要一个解决方案.我想从一个表中减去/添加一个字段值与另一个表.我正在提供细节.
我有两张桌子(相同的结构).
表1 - purchase 字段:id, purchase_from, product_name, quantity, rate
表2 - sales 字段:id, sale_to, product_name, quantity, rate
现在我想从purchase表到sales表中减去数量,并将数据显示到datagridview中.
我试过了,但都失败了.我给你的代码片段.
Dim PurchasePrdName, SalesPrdName As String
Dim PurchaseQty, SalesQty As Double
Private Sub LoadPurchase()
Try
OpenConnection()
Dim dcommand As New MySqlCommand
Dim qry As String = "SELECT ProductName,SUM(Quantity) FROM stockitems GROUP BY ProductId"
dcommand.Connection = conn
dcommand.CommandText = qry
Dim dbread As MySqlDataReader = dcommand.ExecuteReader
DataGridView1.Rows.Clear()
While dbread.Read
If dbread.HasRows Then
PurchasePrdName = dbread("ProductName").ToString
PurchaseQty …Run Code Online (Sandbox Code Playgroud) 我在HTML中调用了两个函数
<body onload="myFunction()" onmousemove="myFunction1()">
我想从一个执行这两个函数javascript文件,并调用这个文件在我HTML喜欢
<script type="text/javascript" src="path/to/functions.js"></script>
即两个函数都将从javascript文件调用,而不是从html调用.
我试过了
window.addEventListener('load', myFunction());
window.addEventListener('onmousemove', myFunction1());
要么
$(window).load(function () {
myFunction();
});
$(window).onmousemove(function () {
myFunction1();
});
Run Code Online (Sandbox Code Playgroud)
但失败了.
我该怎么办 ?
细节
我有一个javascript文件,其中有一些功能.
script.js
function myFunction() {
alert("This is my function");
}
function myFunction1() {
alert("This is my second function");
}
Run Code Online (Sandbox Code Playgroud)
我在我的html body标签中调用了这些函数
<body onload="myFunction()" onmousemove="myFunction1()">
现在我想从我script.js这样称呼这两个函数
window.addEventListener('load', myFunction());
window.addEventListener('onmousemove', myFunction1());
Run Code Online (Sandbox Code Playgroud)
我该怎么办 ?
我想你已经理解了我的要求.
html ×2
javascript ×2
mysql ×2
apache ×1
asp.net ×1
base-path ×1
codeigniter ×1
datagridview ×1
iis ×1
jquery ×1
mod-rewrite ×1
php ×1
url ×1
vb.net ×1
web-config ×1