我正在一个项目中,我必须使用php动态编写php,html和javascript文件。我差不多完成了,但是唯一的事情是文件没有正确缩进,例如,它是以这种方式写文件的
import sqlalchemy
import urllib
import pyodbc
def write_to_sql(s_df):
sql_conn_url = urllib.quote_plus('DRIVER={ODBC Driver 13 for SQL Server};SERVER=ser;DATABASE=db;UID=sqoop;PWD=#####;')
sql_conn_str = "mssql+pyodbc:///?odbc_connect={0}".format(sql_conn_url)
engine = sqlalchemy.create_engine(sql_conn_str)
s_df.rename(columns=lambda x: remove_table_alias(x), inplace=True)
s_df.to_sql(name='tbl2', schema='dbo', con=engine, chunksize=10000, if_exists="append", index=False)
def remove_table_alias(columnName):
try:
if(columnName.find(".") != -1):
return columnName.split(".")[1]
return columnName
except Exception, e:
print "ERROR in _remove_table_alias ",str(e)
如何通过php格式化或缩进?
================= File spacing starts from here ==============
<?php
namespace App\Http\Controllers\abcx
use Illuminate\Http\Request;
class abcx extends Controller
{
public function index()
{
}
}